-
Notifications
You must be signed in to change notification settings - Fork 37
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
Common rules for inclusion and querying #210
Common rules for inclusion and querying #210
Conversation
…try Listing Endpoints' covers this now.
…excluded' to '**Response**: REQUIRED in the response' as paragraph in 'Entry Listing Endpoints' covers this now.
…s is now covered in 'API Filtering Format Specification'.
Thank you for doing the job with this PR! This will greatly help to avoid a situation with all implementations having slightly incompatible interpretations of the rules of when to, and when not to, include output fields. However, with the edits you've made so far in this PR, don't you have to also update the definition of
into something like
|
Right, the suggested change to |
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.
Thanks @merkys!
I think you can definitely include the changes to response_fields
here as well, as was suggested by @rartino. While it is a lot of changes in one PR, they are deeply connected. In the end, we do not squash and commit, so the commits will still be separate no matter what. So for the purposes of the PR, it is nice to have it done all-in-one :)
optimade.rst
Outdated
@@ -1656,8 +1656,7 @@ lattice\_vectors | |||
- **Type**: list of list of floats. | |||
- **Requirements/Conventions**: | |||
|
|||
- **Response**: REQUIRED in the response unless explicitly excluded, except when property `dimension_types`_ is equal to :val:`[0, 0, 0]` (in this case it is OPTIONAL). | |||
- **Query**: Support for queries on this property is OPTIONAL. If supported, filters MAY support only a subset of comparison operators. | |||
- **Response**: REQUIRED in the response. |
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.
I presume it is intentional to leave out the conditional here?
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.
Yes. The intent was to simplify the rules for inclusion/exclusion of properties. Also I had PR #206 in mind while developing the current PR.
@@ -1977,7 +1965,6 @@ Database-provider-specific entry types MUST have all properties described above | |||
|
|||
- **Requirements/Conventions for properties in database-provider-specific entry types**: | |||
|
|||
- **Response**: OPTIONAL in the response. | |||
- **Query**: Support for queries on these properties are OPTIONAL. |
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.
You've deleted this for some that are OPTIONAL in the response, but not all. How do you justify this? Or rather, what is the implication?
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.
Co-Authored-By: Casper Welzel Andersen <[email protected]>
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.
In my opinion, every PR MUST leave the full specification internally consistent. Without editing the description of response_fields
I don't think this PR fulfills that requirement.
We cannot simultaneously have:
- The
response_fields
parameter described as "only these fields MUST be returned and no others." - A list of fields marked "REQUIRED in the response" with no indication that a valid response can (and should) exclude them if the
response_fields
parameter is used and they are not included.
Hence, I think the easiest solution to this problem by far is to also integrate the fix that was proposed for #209 into this PR, and simply say that REQUIRED properties are always REQUIRED in the response, and resonse_fields
only indicates extra fields to include on top of those.
Otherwise, you need to revert the unless otherwise excluded
caveats and look over the rest of the text for internal consistency with how response_fields
is described to work in the present version.
…ally queryable properties.
Co-Authored-By: Rickard Armiento <[email protected]>
I had forgotten to merge the current state of develop. And, oh wow, that was a painful merge. (I've tried to be careful, and my interpretation is that any bad mistake ought to show up in the diff for the present PR, since it would be reverting changes in the present state of develop. But, I'm honestly not sure on that; I remember a case earlier in the history of optimade.md where we managed to revert some changes in an unclean merge. We couldn't even trace back in which merge it had happened, there were 3 or so candidates...) |
I trust you did the merge right :) OK, so we need yet one more approve. |
Pinging @CasperWA, @sauliusg or @giovannipizzi for a review! |
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.
Finally got around to going through this - sorry for the delay.
I really like the new "Supported".
Thanks for all the hard work that has been put into this PR!
Some things I noticed:
- "Default properties" don't seem to be defined anywhere, but maybe that was just me missing it?
- In the
Entry list
section, there are intermxed uses of eitherfilter features
orfilter operators
. I like both, and both have merit, I just wanted to point it out, to make sure this is a desired change by all - since they do have slightly different meanings/connotations. - In a similar vein,
comparison operators
vs.filter operators
are used for some properties and not others. These make a lot of sense, but we should make sure they are used correctly when changed (or used).
optimade.rst
Outdated
@@ -310,16 +310,13 @@ The text in this section describes how the API handles properties with the value | |||
The use of :val:`null` values inside nested property values (such as, e.g., lists or dictionaries) are described in the definitions of those data structures elsewhere in the specification, see section `Entry List`_. | |||
For these properties, :val:`null` MAY carry a special meaning. | |||
|
|||
REQUIRED properties with an unknown value MUST be returned in the response, unless explicitly left out (e.g., by using :query-param:`response_fields`, see section `Entry Listing URL Query Parameters`_). | |||
Responses that include entries where REQUIRED properties have an unknown value MUST include these properties with the value :val:`null`. |
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 sentence is a bit difficult to read, I think. How about:
Responses that include entries where REQUIRED properties have an unknown value MUST include these properties with the value :val:`null`. | |
REQUIRED properties with an unknown value MUST be included and returned in the response. |
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.
I've edited into:
REQUIRED properties with an unknown value MUST be included and returned in the response with the value :val:
null
.
optimade.rst
Outdated
|
||
OPTIONAL properties with an unknown value MAY be returned in the response. | ||
If an OPTIONAL property is *not* returned in a *full* response (i.e., not using :query-param:`response_fields`), the client MUST assume the property has an unknown value, i.e., :val:`null`. | ||
Responses to requests where OPTIONAL properties have been explicitly requested via the :query-param:`response_fields` query parameter, and which include entries where those properties have an unknown value, MUST include these properties with the value :val:`null`. |
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 may then also be rewritten.
Responses to requests where OPTIONAL properties have been explicitly requested via the :query-param:`response_fields` query parameter, and which include entries where those properties have an unknown value, MUST include these properties with the value :val:`null`. | |
OPTIONAL properties, if requested explicitly via the :query-param:`response_fields` query parameter, MUST be included and returned in the response. |
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.
Your version misses "with an unknown value". Sure, arguably you can say that the statement applies generally--- unknown value or not, but the point of this section is to clarify that these properties need to be in the response even if the value is unknown.
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.
I've edited into:
OPTIONAL properties with an unknown value, if requested explicitly via the :query-param:
response_fields
query parameter, MUST be included and returned in the response with the value :val:null
.
@CasperWA Thanks for the careful review! Hopefully, this version is better. |
…ilter operators'.
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.
@CasperWA Thanks for the careful review! Hopefully, this version is better.
This is looking splendid. Thanks for being so fast and taking care of my late-night review and suggested changes - here are a handful more 😅
I found some typing mistakes and have tried to rephrase a couple of sentences, not much this time.
I think with these last comments taken care of, this should be ready to be merged.
@CasperWA done! |
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.
In discussions with @rartino and @CasperWA over #184 the following ideas over property inclusion have been crystallized:
response_fields
may be used to include optional properties.Similarly,
This PR implements these ideas by adding general notices and cleaning up the 'Entry List' section to explicitly mark only those properties that either included by default or must support querying. (I know, this goes against @CasperWA's idea of having a property reference there, but I have little ideas how to do it otherwise. Machine-readable specs maybe? 😕). Thus fixes #204.
Also this PR:
nsites
from MUST to OPTIONAL (includes Relieve the requirement level of query support for 'nsites' from MUST to OPTIONAL #205)id
andtype
(fixes Exclusion of 'id' and 'type' properties upon request #209)