openapi-pydantic
openapi-pydantic copied to clipboard
Request: Add type parameter to Reference
Wherever a Reference
is used in OpenAPI, it's clear to us what the referred object type is supposed to be. Adding a type parameter to Reference
(and every field that uses it) would make it clear to tools.
If we had schema_or_ref: Schema | Reference[Schema]
, we could also have a resolver function def resolve_ref[T](obj_or_ref: T| Reference[T]) -> T:...
and then schema = resolve_ref(schema_or_ref)
gives us a concrete type.
I'd be happy to prepare a PR, if such change is welcome.