-
Notifications
You must be signed in to change notification settings - Fork 723
feat: openapi spec cleanup for schemathesis fuzzing and cleaner API error responses #6756
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
Draft
simone-stacks
wants to merge
16
commits into
stacks-network:develop
Choose a base branch
from
simone-stacks:chore/openapi-and-405-returns
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+400
−117
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
cde6e63
correct some OpenAPI schema validations and response types
simone-stacks 1bc0a97
add principal/contract-address schemas and fix type constraints
simone-stacks 66f1356
remove unused example files
simone-stacks 1d4ee1a
keep redocly happy
simone-stacks 031804a
create principals schemas and re-add tip pattern and maxLength
simone-stacks 8206dcc
improve OpenAPI schemas with u32 range constraints
simone-stacks 19b0984
implement proper 405/400/404 HTTP error responses with Allow header
simone-stacks e1a3b9c
keep linters happy
simone-stacks 84b11cb
Merge branch 'develop' into chore/openapi-and-405-returns
simone-stacks f4c3dec
Merge branch 'develop' into chore/openapi-and-405-returns
simone-stacks d93faa6
add SM and SN in the principal patterns
simone-stacks 3c98ef9
add current_epoch as a required field
simone-stacks c797975
add SM SN examples and enforce even-length hex patterns
simone-stacks 5b299a7
auto-generate permissive regexes, add structured 405 error type
simone-stacks 91c9ad5
update openapi removing 0x and adding 400 for some endpoints
simone-stacks 5bff836
Merge branch 'develop' into chore/openapi-and-405-returns
simone-stacks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
4 changes: 0 additions & 4 deletions
4
docs/rpc/components/examples/fee-transaction-request.example.json
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
docs/rpc/components/examples/post-block-proposal-request.example.json
This file was deleted.
Oops, something went wrong.
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
6 changes: 0 additions & 6 deletions
6
docs/rpc/components/examples/stackerdb-chunk-data-request.example.json
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,9 @@ | ||
| # Deployer address for contract endpoints (standard principal format) | ||
| name: contract_address | ||
| in: path | ||
| required: true | ||
| description: | | ||
| Standard Stacks address (e.g. `SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0`). | ||
| Must be 28-41 characters long using Stacks base58check format. | ||
| Must be 28-41 characters long using Stacks c32check format. | ||
| schema: | ||
| type: string | ||
| pattern: "^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$" | ||
| minLength: 28 | ||
| maxLength: 41 | ||
| example: SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0 | ||
| $ref: '../schemas/standard-principal.schema.yaml' |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| name: principal | ||
| in: path | ||
| required: true | ||
| description: | | ||
| Standard Stacks address (standard principal, not contract principal). | ||
| Must be 28-41 characters long using Stacks c32check format. | ||
| schema: | ||
| $ref: '../schemas/standard-principal.schema.yaml' |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,9 @@ | ||
| type: string | ||
| pattern: "^([a-zA-Z0-9_]|[-!?+<>=/*]){1,128}$" | ||
| description: | | ||
| A valid Clarity name. Must either: | ||
| - Start with a letter and contain only letters, numbers, and [-_!?+<>=/*] | ||
| - Be exactly one of the special characters: - + = * / | ||
| - Be a comparison operator: < > <= >= | ||
| pattern: "^[a-zA-Z]([a-zA-Z0-9]|[-_!?+<>=/*])*$|^[-+=/*]$|^[<>]=?$" | ||
| minLength: 1 | ||
| maxLength: 128 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Standard principal or contract principal (address.contract-name) | ||
| type: string | ||
| pattern: "^S[PTMN][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26,39}(\\.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127})?$" | ||
| minLength: 28 | ||
| maxLength: 170 | ||
| examples: | ||
| - SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0 | ||
| - SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info | ||
| - ST000000000000000000002AMW42H | ||
| - SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G | ||
| - SN2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKP6D2ZK9 |
13 changes: 9 additions & 4 deletions
13
docs/rpc/components/schemas/read-only-function-args.schema.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,22 @@ | ||
| description: Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/stacksgov/sips/blob/main/sips/sip-005/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset | ||
| type: object | ||
| additionalProperties: false | ||
| required: | ||
| - sender | ||
| - arguments | ||
| properties: | ||
| sender: | ||
| type: string | ||
| description: The simulated tx-sender | ||
| description: The simulated tx-sender. | ||
| allOf: | ||
| - $ref: './standard-principal.schema.yaml' | ||
| sponsor: | ||
| type: string | ||
| description: The simulated sponsor address | ||
| description: The simulated sponsor address. | ||
| allOf: | ||
| - $ref: './principal.schema.yaml' | ||
| arguments: | ||
| type: array | ||
| description: An array of hex serialized Clarity values | ||
| items: | ||
| type: string | ||
| pattern: "^(0x)?([0-9a-fA-F]{2})+$" | ||
| description: Hex-encoded Clarity value (optionally prefixed with 0x) |
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
10 changes: 10 additions & 0 deletions
10
docs/rpc/components/schemas/standard-principal.schema.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Standard principal only, no contract suffix | ||
| type: string | ||
| pattern: "^S[PTMN][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26,39}$" | ||
| minLength: 28 | ||
| maxLength: 41 | ||
| examples: | ||
| - SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0 | ||
| - ST000000000000000000002AMW42H | ||
| - SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G | ||
| - SN2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKP6D2ZK9 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ type: object | |
| required: | ||
| - error | ||
| - reason | ||
| - reason_data | ||
| - txid | ||
| properties: | ||
| error: | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.