-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add CRUD Endpoints for Dictionary References #67
Comments
Spec ProposalCreate all 4 CRUD endpoints. Get Reference
Get will return a single path from the references object. This is a bit awkward compared to the other endpoints which allow interaction with multiple paths simultaneously, but since the cost of returning all references to look through is low this seems like the simplest interface for the consumer to get as wide or as narrow a view of the references as they need. Path Parameters
ReturnsA JSON object containing the references in the property { "data": "Value of the reference" } But if a nested object with references is at the specified path, this will return that nested value, for example a query on a hypothetical {
"data": {
"contactPreference": ["Phone", "Email", "House Call"],
"emotion": ["Happy", "Sad", "Surprised", "Excited"],
"responses": {
"all": ["#/codeLists/responses/yesOrNo", "#/codeLists/responses/maybes"],
"maybes": ["Maybe", "Not Sure", "I don't know"],
"yesOrNo": ["Yes", "No"]
}
} If the reference is not found, will return a Create References
This will create a new version of an existing dictionary with the provided references added. The new dictionary will have the same name and incremented minor version. If semantic versioning has been implemented, instead this should increment the patch version. Path Parameters
Query Parameters
BodyJSON Object with the new content to insert into the dictionary's references. This may contain one or multiple reference values. It is required that all reference values in the input object are new. If any of the new input reference values alreadu exist the entire request will be rejected with no changes applied. Example body with a single reference at {
"codeLists": {
"colours": ["White", "Blue", "Black", "Red", "Green"]
}
} Example body with multiple references along different paths. The values (of type {
"codeLists": {
"types": {
"cards": ["Artifact", "Battle", "Creature", "Enchantment", "Instant", "Land", "Sorcery", "Planeswalker"]
},
"colours": ["White", "Blue", "Black", "Red", "Green"]
},
"regex": {
"cost": "^({((([WUBRG]|([0-9]|[1-9][0-9]*))(\/[WUBRG])?)|(X)|([WUBRG](\/[WUBRG])?\/[P]))})+$"
}
} ReturnsIf successful: JSON object with the following properties of the new dictionary: name, version, and ID. ID is not included if On error, either:
Update References
The new dictionary will have the major value incremented since reference changes can invalidate existing data (breaking changes). Path Parameters
Query Parameters
BodyJSON Object with the new content to update int the dictionary's references. This may contain one or multiple reference values. Since these changes will overwrite existing values, Lectern will validate the changes by attempting to resolve the references in schemas. If any modifications result in an invalid schema then the update will return with a list of the errors in the update. See the Create Reference documentation for examples of body content. The structure is the same. ReturnsIf successful: JSON object with the following properties of the new dictionary: name, version, and ID. ID is not included if
In the case that the request is properly formed but updating the requests cause the schemas to be invalid, you will receive a list of Delete Reference
Path Parameters
Query Parameters
BodyJSON array of the paths to delete. Example with a list of references to delete. ["regex", "codeList/colours", "codeList/types/cards"] ReturnsIf successful: JSON object with the following properties of the new dictionary: name, version, and ID. ID is not included if
In the case that the request is properly formed but deleting those references causes the schemas to be invalid, you will receive a list of |
The text was updated successfully, but these errors were encountered: