-
Notifications
You must be signed in to change notification settings - Fork 15
update event types #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update event types #266
Conversation
|
also adding @salichon for awareness |
junghao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add the test cases to the routes test, see how querying other events and volcano-tectonic parameter works?
Thanks.
| var nslcReg = regexp.MustCompile(`^([\w*?,]+|--)$`) | ||
| var eventTypeReg = regexp.MustCompile(`^([\w*?, ]+|--)$`) // space allowed | ||
| // nslcReg: FDSN spec allows all ascii, but we'll only allow alpha, number, _,-, ?, *, "," and "--" (exactly 2 hyphens only) | ||
| var nslcReg = regexp.MustCompile(`^([\w*?,]+(?:-[\w*?,]+)*|--)$`) // space not allowed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This nslcReg is used to verify network/station/location/channel identifiers, is not for event type.
We don't have any identifiers containing -.
However, it's fine to add this since it's in FDSN specification.
| var eventTypeReg = regexp.MustCompile(`^([\w*?, ]+|--)$`) // space allowed | ||
| // nslcReg: FDSN spec allows all ascii, but we'll only allow alpha, number, _,-, ?, *, "," and "--" (exactly 2 hyphens only) | ||
| var nslcReg = regexp.MustCompile(`^([\w*?,]+(?:-[\w*?,]+)*|--)$`) // space not allowed | ||
| var eventTypeReg = regexp.MustCompile(`^([\w*?, ]+(?:[ -][\w*?,]+)*|--)$`) // space allowed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure which cases are this change aim to deal with?
If it's for -, then I think adding a \- to existing regex is sufficient.
^([\w*?,\- ]+|--)$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to allow - in the middle, and it needs to be multiple times, yes adding a - to existing regex is simpler, may be it doesn't matter if - is in the start, but it also allow more than 2 hyphens (---)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless the specification says "no hyphen at the start" (though people won't do it) otherwise we don't need to make sure it's in the middle.
4a0469d to
5b6516e
Compare
junghao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
add routes test for event types as per review
|
@bpeng Update event type in validation and add tests for new event types I am interested to see an example this looks good as a process thanks |
salichon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with regards to check with examples :)
|
Thanks @salichon
The additional types should be already working for scml processing and the event types can be added to the database, but I haven't seen any events with the volcanic types in The updates in this PR is to allow queries by the new event types like the following (currently it returns 400 error) after deployment (probably get 204 response if there is not such event with the specified type in the DB). |
Ticket https://github.com/GeoNet/tickets/issues/17374
Update event type in validation and add tests for new event types
Deployed on dev, try