-
Notifications
You must be signed in to change notification settings - Fork 225
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
utoipa-axum: silently overwrites schemas on name collisions #1154
Comments
Yeah while this would be a beneficial to check whether type already exist before adding it the the schemas. It comes with performance cost as it would be then necessary before adding schema to loop over all schemas and check whether same name already exists. Nonetheless only thing that could be done is either |
Axum panics on conflicting routes, so panicking on schema conflicts is what I would expect too.
I'm not familiar with internals of |
Right, this needs some experimenting to see what can be done to fix this. This is not just only a |
After giving this more thought. I don't think that What we could perhaps do is, not to add already added types. But that is effectively same as adding it. If we added a |
Can the builder that merges schemas into |
Perhaps the
If it was to panic on existing type ids, the behavior would not allow using types with the same references as some other type might have as a Personally I don't think that it is very good to limit users to allow only new types as schema references disallowing completely reuse of types implementing |
I'm integrating
utoipa-axum
into a project where individual handlers are separated into modules with uniform naming of DTO types, e.g.:When used like this, the resulting
openapi.json
contains only oneResponseBody
schema - last handler wins during the merge.I can of course use this to rename the schemas:
Having to rename is reasonable, as they end up in a shared namespace, but the key problem is that
utoipa
doesn't return errors on name collisions, thus making such mistakes very likely in a large project.The text was updated successfully, but these errors were encountered: