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

"type" field not marked as required for derived entry resource models #479

Closed
ml-evs opened this issue Aug 31, 2020 · 0 comments · Fixed by #480
Closed

"type" field not marked as required for derived entry resource models #479

ml-evs opened this issue Aug 31, 2020 · 0 comments · Fixed by #480
Labels
bug Something isn't working schema Concerns the schema models

Comments

@ml-evs
Copy link
Member

ml-evs commented Aug 31, 2020

As @CasperWA has pointed out, "type" does not appear as a required key for StructureResource and also LinksResource in the generated specification, because they are specified as constant fields in our models. The suggestion is to switch from Field("structures", const=True, ...) to e.g. constr(regex='^structures$'), and at the same time, we could contribute back to pydantic with a schema representation for the const string; StackOverflow suggests an enum with only one value.

Furthermore, I found that type is not listed as "required" for a StructureResource. Also, the constant value of "structures" is not provided in the specification. We could force this through the pattern property, e.g.? I even think this should be contributed upstream to FastAPI.

Originally posted by @CasperWA in #477 (comment)

@ml-evs ml-evs added bug Something isn't working schema Concerns the schema models labels Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working schema Concerns the schema models
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant