-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Can't use schemaId "FullType" for type "FullType" #2679
Comments
Hi again,
with a mix of odata route and non-odata routes....
And thus my naive conclusion : |
to add to this issue, i managed to make it crash using a dictionary...
create
|
I've also recently ran into this issue and it's driving me crazy. And I see there is no progress on the pull request made by the op either. |
Hello, just here to say that i still hit the error and have not found a way to workaround it.... (and make some noise just for not closing this issue) |
@domaindrivendev i'm sorry to hook you up like this, but i really would like to solve this issue and i constantly hit it. When you'll have some time to spare could you tell me what i could do to make passe the PR (and if you would accept it) Thanks for your time and effort (and sorry again) |
…ntime error. domaindrivendev/Swashbuckle.AspNetCore#2679 Instead changed the runtime to throw error if same id path is used for different schemas. for Havunen/DotSwashbuckle#3
This will be fixed in DotSwashbuckle 3.0.3, can you test using it please. The runtime was changed to throw error only if registering different schema to same id multiple times. https://github.com/Havunen/DotSwashbuckle |
…ntime error. domaindrivendev#2679 Instead changed the runtime to throw error if same id path is used for different schemas. for #3
@Havunen thanks but sadly i use |
@Angelinsky7 Your repro was helpful. There are a litany of problems, but I peeled back just the most relevant to get things working. In no particular order:
The main problem is that The following is a working example. I bumped up to .NET 8 so that you have the latest library versions and fixes. Only .NET 6 and 8 will get servicing since they are LTS. |
@glasody the reason this is happening is that you have split things across OData route prefixes. An OData route prefix does not define a sub application or segregation. The API Explorer and OpenAPI see everything collated together. If you define the same physical or logical data model with the same name under two different route prefixes, they will be generated from two different EDMs. Since the model name is the same, this will result in a collision. There is not a great way to know that the same model in an OpenAPI document has already been defined by another EDM. In the most technical since, this might be possible, but it would be slow and would be proportional to the number and size of EDMs defined. I've seen people try to define something like // ~/orders
builder.EntitySet<Order>("Orders");
// ~/admin/orders
builder.EntitySet<Order>("Orders").EntityType.Name = "AdminOrder"; If you have a repro you can share, I can help spot the issue if that doesn't clear things up. I'm pretty sure you have two different representations that are colliding. The CLR types |
@commonsensesoftware thank you so much for your wonderful answer ! |
@Angelinsky7 Do you consider this specific issue closed now? I'm still happy to take the change from #2695 though. |
@martincostello sorry for the late answer. Yes, we can close this. For the ones looking for a "workaround" you can either look at the answers of @commonsensesoftware that are completely correct or you can change the The only thing that could be done: to have a better error message when this kind of error is happening, But i would argue that's for another PR. (but i would gladly do it, if you think is ok) |
Hello,
i've got an issue or i really don't understand something.
I would like to have 2 different controller's actions returning the same type.
in one :
in the second:
but i've got this exception raising:
System.InvalidOperationException: Can't use schemaId "$NAMESPACE.Http.Dto.v1.CheckJobListDto" for type "$NAMESPACE.Http.Dto.v1.CheckJobListDto". The same schemaId is already used for type "$NAMESPACE.Http.Dto.v1.CheckJobListDto"
I've read some things about it and of course i've changed this (the commented option is a advanced version but behave the same as the second one)
Could someone help me understand how i can do this. It seems to me natural to have multiple endpoints returning the same type at different place (in my case i need to have those two for historical reasons)
Thanks !
The text was updated successfully, but these errors were encountered: