microsoft / microsoft/OpenAPI.NET.OData
When EnableDiscriminatorValue is set to true all types end up with a required property of odata.type
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 240
- Fork
- 70
- Merge medio
- 7h 59m
- PR unite (30g)
- 13
Descrizione
My understanding is odata.type is only required in the case the type cannot be determined such as it being a type derived from the specified type.
When using EnableDiscriminatorValue = true I get correctly odata.type used as a discriminator when a type has a derived type.
I also get however for seemingly all types, odata.type included as a required property.
Assemblies affected
v1.1.0
Steps to reproduce
- Create an odata model with no derived types.
- Generate an Open API specification from the model with EnableDiscriminatorValue = true.
Expected result
I would only expect odata.type to be required in the case a type is a derived type.
Actual result
odata.type is set as required for all types.
If I use Open API connected services in Visual Studio with the specification to generate a client, the client will fail to deserialize responses missing the required property by default.
Additional detail
This can be worked around in most case.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il problema con un modello OData che non abbia tipi derivati e con EnableDiscriminatorValue impostato su true, quindi esamina la specifica OpenAPI generata. Traccia il modo in cui i metadati del discriminatore diventano una proprietà obbligatoria; il lavoro è completato quando odata.type è obbligatorio solo dove i tipi derivati lo rendono necessario, senza compromettere la deserializzazione valida del client.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, openapi
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100