Skip to content
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

Use schema template for 403 errors #1133

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Conversation

lognaturel
Copy link
Member

@lognaturel lognaturel commented Apr 29, 2024

I noticed that https://docs.getodk.org/central-api-entity-management/#updating-an-entity has a 403 example with code and message both set to pencil. I imagine that's some fallback when no examples are specified.

We have a nice schema template for 403 errors so I went through and used that everywhere.

Some endpoints like the one above had 403s defined with json and json/extended response types. In those cases, I removed the json/extended one.

Some endpoints redundantly specified an example along with the schema reference which itself specifies the same examples. I removed the redundant ones.

Some endpoints have 403 responses with other response types (e.g. https://docs.getodk.org/central-api-form-management/#draft-form). I think that's also a mistake but didn't want to look too deeply into it for now.

What has been done to verify that this works as intended?

Rendered docs with make api-docs, spot checked a few 403s.

Why is this the best possible solution? Were any other approaches considered?

Yay for reduction of duplication.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Docs-only.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

This does update it.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@matthew-white
Copy link
Member

This is only sort of related, but one thing I'm wondering about is the code property of the Error403 schema. It looks to be a string, but Problem codes are actually numbers.

@lognaturel
Copy link
Member Author

lognaturel commented Apr 30, 2024

Great, we now have a single place to fix it! Let's roll it into this change.

I changed all the templates but didn't go through the ones that are defined inline.

@lognaturel lognaturel merged commit d036f2e into getodk:master Apr 30, 2024
1 check passed
@lognaturel lognaturel deleted the docs-error403 branch April 30, 2024 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants