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

derive Object on tuple structs or allow Type trait impl #988

Open
nicrosengren opened this issue Feb 23, 2025 · 0 comments
Open

derive Object on tuple structs or allow Type trait impl #988

nicrosengren opened this issue Feb 23, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@nicrosengren
Copy link

This is in regards to poem-openapi.

Description of the feature

Allow implementation of trait Type by exposing MetaSchemaRef and Registry.

or

Make the Object derive macro accept tuple structs and use the inner types implementation of Type.

Background

I commonly use tuple structs to wrap types from dependencies to allow more control over them. This might be to control parsing, easier maintenance or just adding my own functions to them.

In this case it is my type DateTime, which is currently implemented using time::OffsetDateTime (which you support).

In order to use these types with poem-openapi I need to implement the trait Type.
This is however not possible since neither MetaSchemaRef nor Registry are exported by poem-openapi.

Using the Object derive macro with remote is not possible since fields need to be named.

It would be great if the Object derive macro allowed tuple structs and used the Type impl of the wrapped type.

@nicrosengren nicrosengren added the enhancement New feature or request label Feb 23, 2025
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

No branches or pull requests

1 participant