-
Notifications
You must be signed in to change notification settings - Fork 9
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
API verb and GET query patterns #5
Comments
On the GET request and dates, I would prefer a "from_" and "to_" kind of prefix. "Before_" suggest to me <"2019-06-01", so implicitly stating <="2019-05-31". I feel that defining a range for dates is better than < or > statements. Or open the option to do both, similar to some frameworks out there stating: Also wonder about the "unlocode" part of this: GET /Voyages?Unlocode=AUBNE. I think it is not clear which Unlocode this would be referred to, assuming that it could exist in something else related to the model but not the "LogisticsLocation". Example: Name. GET/Voyages?Name="1111". Which name should be considered? Should there be a definition on how these "related object fields" are named so that it is clear, which one this refers to? |
Hi Chad - thanks for the feedback. Agree on the from/to and will reflect that in the spec. Also the use of operators on query parameters is an interesting direction and worth consideration - but probably not in this UML profile spec and maybe in the OpenAPI NDR (not yet written - but will contain all those best practices for JSON APIs. On the question on what exactly the attribute like "unlocode" applies to - in the actual UML model it is possible to link the operation parameter to a class so if you look closely at the model it will indicate that unlocoode GET parameter is the attribute of TransportLocation. Having said that - this is only in the model and the generate spec just says "unlocode". I can see a couple of choices:
THoughts? |
I've requested a tweak to the free API generator gs-gs/staruml-cefact#16 per your suggestion. |
I would vote for the later option:
|
Actually - thinking about it a bit more, a standard way to represent more complex queries in URL strings could be handy. but I'm struggling to find a really solid reference. There are some good posts like this one https://stackoverflow.com/questions/40618327/how-to-design-generic-filtering-operators-in-the-query-string-of-an-api . Also there are some older specs like this https://github.com/persvr/rql. Any thoughts? Obviously https://graphql.org/ is getting pretty popular these days but that is a much more than a few extra options in a REST query string... |
for example:
|
After reading the stackoverflow articules (thanks for that reference!), I lean towards your example 1 (being example 2 in stackoverflow). It seems simple enough to read and parse and operator is just an "extension" that can or cannot be used: |
Agreed - simple is good. Lets leave it at that then.
|
I'm indifferent to the The list of comparison operators (gt, lt, eq) should be pretty uncontroversial, since they have been used consistently in unix tools for many decades. Increasing specaficity from left->right feels natural because that's how numbers work (and dates, in many parts of the world) |
Starting this issue as a discussion forum for how we should model and generate API behaviour for verbs (GET, POST, PATCH, PUT) and GET collection query parameters.
My suggestion, using the Voyages
<<interface>>
from the attached sample diagramPOST:
UML representation is an Operation POST(Voyage) in the Voyages interface.
GET:
Represented as parameters in operations in the UML interface class. The parameters MUST have the name of the attribute in the resource model that will be used as the filter. The UML type of the parameter SHOULD be set to the UML class that has the filter attribute.
PATCH:
Same as POST except that {id} must be specified in the path PATCH /Voyages/id/ body of JSON voyage structure.
The text was updated successfully, but these errors were encountered: