openapi-pydantic icon indicating copy to clipboard operation
openapi-pydantic copied to clipboard

Request: Add type parameter to Reference

Open rafalkrupinski opened this issue 5 months ago • 3 comments

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.

rafalkrupinski avatar Aug 31 '24 02:08 rafalkrupinski