Skip to content

Default presence of odata.type property in generated OpenAPI #304

@andrueastman

Description

@andrueastman

Currently, all models are generated by with a default value for the @odata.type property which is further propagated into generated models in Kiota. This shouldn't be an issue per se but various workloads seem to not support the existence of this property as seen in the numerous linked issues to microsoftgraph/MSGraph-SDK-Code-Generator#534 (comment).

The proposal therefore is to have the @odata.type not set by default in the result openApi generation and have it set in the following conditions where type disambiguation is necessary as the API will need to know the type to infer and take advantage of the properties.

  1. The type derives from an abstract type
  2. One of its base/parent types is referenced as the type for a property in another type (except if the base is entity).
  3. One of its base types is referenced as the type in an odata action in another type (except if the base is entity).

Possibly, the default behaviour could have the @odata.type property set/unset and then we would add a setting to enable this behaiour as this may not really be a valid ask for another odata API needing the conversion to be performed.

Related issues

Metadata

Metadata

Assignees

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:bugA broken experience

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions