Closed
Description
Now that we've fixed the references behaviour, I believe that Discriminator mappings should be a Dictionary<string, OpenApiSchemaReference>
instead of <string, string>
so currently
Discriminator = new()
{
PropertyName = "@odata.type",
Mapping = new Dictionary<string, string> {
{
"#microsoft.graph.directoryObject", "#/components/schemas/microsoft.graph.directoryObject"
},
{
"#microsoft.graph.file", "#/components/schemas/microsoft.graph.file"
}
}
},
tomorrow
Discriminator = new()
{
PropertyName = "@odata.type",
Mapping = new Dictionary<string, string> {
{
"#microsoft.graph.directoryObject", new OpenApiSchemaReference("microsoft.graph.directoryObject")
},
{
"#microsoft.graph.file", new OpenApiSchemaReference("microsoft.graph.file")
}
}
},
There are a number of reasons for doing that:
- the syntax of the references (
#/components/schemas
) varies between v2 and v3, and might vary in v4. And we shouldn't expect the user to know about that/have to change it between different serialization versions. - using references would bring the resolution logic in place which would not only improve checking for document integrity but also let the user navigate to the target from the object model.
Before we do any work on that, I'd like @darrelmiller to chime in.