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

Refactor RequestSchema and ResponseSchema into a single Schema #161

Open
Sytten opened this issue Jan 31, 2020 · 3 comments · May be fixed by #169
Open

Refactor RequestSchema and ResponseSchema into a single Schema #161

Sytten opened this issue Jan 31, 2020 · 3 comments · May be fixed by #169
Labels
enhancement New feature or request

Comments

@Sytten
Copy link

Sytten commented Jan 31, 2020

  • RequestSchema is only needed in v2 to reject additional fields
  • ResponseSchema is currently not playing too well with IDE (pycharm cough) because its missing a constructor with the kwargs (see ResponseSchema is missing constructor parameters #137)
  • Having two to inherit from 2 schemas is not that nice since we use them a lot in requests and responses (see PR Improve "basics" docs #152)
  • It's easy to forget and just use Schema from marshmallow (our doc does a poor job of recommending them too)

For those reasons I think we should refactor that into a single class that we use in all the tutorials and doc.

@airstandley airstandley added the enhancement New feature or request label Feb 3, 2020
@airstandley
Copy link
Contributor

I do like that having two classes makes the intention of derived classes clear. I hardly think that outweighs the negatives you've laid out though.

@airstandley
Copy link
Contributor

Reading over the comments on #152, I'd like to propose that we name this unified single Schema something like StrictSchema.

I think that might make it a bit clearer when explaining that marshmallow.Schema works fine, but we recommend using StrictSchema to enforce the OpenApi specification on input/outputs.

@Sytten
Copy link
Author

Sytten commented Feb 4, 2020

I like the name, I will work on the implementation

@Sytten Sytten self-assigned this Feb 5, 2020
@Sytten Sytten linked a pull request Feb 8, 2020 that will close this issue
@Sytten Sytten removed their assignment Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants