You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am generating the petstore spec,
the model PetId is not really used, we use it to spread it as parameters:
op create(...PetId): Pet;
but this model is actually not used.
The server gen still generates it, and it cannot compile because this model has a property with the same name as the model.
publicpartialclassPetId{publicintPetId{get;set;}// this will not compile.}
Either, the server gen should not generate the model that is not used, or we should do something on the generated model to ensure it never has a property with the same name as its enclosing type.
Or I think we should do both.
The text was updated successfully, but these errors were encountered:
@ArcturusZhang This is currently by design. Using an alias will prevent such a type from being emitted. Eventually, I think all emitters should have an equivalent of the omit-unreachable-types setting that limits the generated types to those that are reachable from operations. But generating all user-supplied types should be the default.
Keeping this issue to track omit-unreachable-types as a setting
markcowl
changed the title
[http-server-csharp] Spread but unused models are generated
[http-server-csharp] Support omit-unreachable-types setting in config to exclude types not used in operations
Nov 18, 2024
@ArcturusZhang This is currently by design. Using an alias will prevent such a type from being emitted. Eventually, I think all emitters should have an equivalent of the omit-unreachable-types setting that limits the generated types to those that are reachable from operations. But generating all user-supplied types should be the default.
Keeping this issue to track omit-unreachable-types as a setting
make sense. C# generator has this setting, unreference-type-handling.
I am generating the petstore spec,
the model
PetId
is not really used, we use it to spread it as parameters:but this model is actually not used.
The server gen still generates it, and it cannot compile because this model has a property with the same name as the model.
Either, the server gen should not generate the model that is not used, or we should do something on the generated model to ensure it never has a property with the same name as its enclosing type.
Or I think we should do both.
The text was updated successfully, but these errors were encountered: