Closed hathawsh closed 11 months ago
Hey @mike-oakley , what are your thoughts on this PR?
Sorry - missed this one before!
This PR removes the "name" and "in" fields from Header objects.
Makes sense - I guess this is breaking but simple transition is to switch to 'Parameter' objects if using 'Header' in the request specs instead of the shared models.
Also made two fields optional that were causing validation failures: allowReserved and allowEmptyValue.
Can you highlight why this is necessary? Seems that by making them optional we're deviating from the defaults in the OpenAPI spec?
I used openapi-spec-validator
to validate a generated OpenAPI spec; those extra fields caused the validation to fail. I think what I should do is add openapi-spec-validator
to this project as a testing dependency, then add test cases that reveal validation failures as they're discovered. Then we'll be able to discuss the validation failures more easily.
👍🏼 sounds good to me
Any updates on this one? This became a blocking issue because of allowEmptyValue
@manycoding: I learned that if I add exclude_defaults=True
to the model_dump
call, the allowEmptyValue
issue goes away. The generated JSON no longer contains the invalid key.
@mike-oakley This PR now adds the openapi-spec-validator
dependency and adds tests that verify we're generating spec-compliant JSON. I added some cases that previously failed validation, particularly a header spec.
LGTM - thanks @hathawsh!
Released to PyPI in version 0.4.0 🎉
This PR removes the "name" and "in" fields from Header objects. The OpenAPI spec says they must not be present:
https://spec.openapis.org/oas/latest.html#header-object
Also made two fields optional that were causing validation failures:
allowReserved
andallowEmptyValue
.