Repository navigation
Generated OpenAPI v3.0 specs with recorded examples and tested guides - #2
Draft
cryptalith wants to merge 8 commits into
Draft
cryptalith wants to merge 8 commits into
cryptalith wants to merge 8 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
openapi/orcid-member-api.jsonis now the Member API description thatORCID-Source generates (COMMS-5397: COMMS-5397 (a) OpenAPI generator wiring for API v3.0 ORCID/ORCID-Source#7758, #7759, #7760). It is presented for the docs:
sandbox servers,
bearerAuthfirst for try-it, JSON only.openapi/orcid-public-api.jsoncovers the Public API's 56 operations.minimal,missing-city,put-code-mismatch, ...), but each is recorded rather than written by hand. Where the hand-written onesdisagreed with the API, the recorded ones show what the API does:
401(9017);404needs a 2-legged token;public; a client can always read what it added.
record has a "When a read fails" table of the errors the suite produced.
other-id, which the API stores asother_id, so a second one nevermatches the first. It now uses
grant_number, which answers409(9021) the second time.403 forbidden; malformed JSON is aplain-text
400, not 9047;4019017 also covers an iD that doesn't exist; the impossible404row is gone.lmendoa/update-delete(808dce0) and a merge of the latestmain.Every code block is checked
The contract suite checks every code block on these pages against a disposable Registry. cURL, Python and
JavaScript blocks are run, with the sandbox hosts and the placeholders (
0000-0002-1825-0097,<ACCESS_TOKEN>,1234567) swapped for the test stack's values; a run block can reach only the stack. A JSON payload block issent to its operation and must get the documented answer; a response block is validated against the spec:
response, a displayed
201, and the placeholder text on ReadMe's welcome page.docs/manifest.yamlisreviewed again.
The reference examples are recorded the same way: each is a request and response the suite sent to a running
Registry. They are normalised to the docs' persona, placeholders and sandbox hosts.
Before merging
Create a spec named
Orcid-Public-POCin GitBook fromopenapi/orcid-public-api.json. The new "Public APIreference" block in
api-reference/SUMMARY.mdpoints at it and shows nothing until it exists.After merging
Orcid-POCin GitBook. If it was imported from a URL, use "Check for updates". Otherwise runnpx -y @gitbook/cli@latest openapi publish --spec Orcid-POC --organization <org-id> openapi/orcid-member-api.jsonwith your
GITBOOK_TOKEN. Do the same forOrcid-Public-POCwhen the public spec changes.Not changed
product-docs/guides/write-update-and-delete-works.md(Mari's v2.1 XML guide). The new "Add and update works"page has tested v3.0 examples it could point to.