Skip to content

Conversation

@irvinesunday
Copy link
Contributor

Fixes #304

This PR:

  • Adds support for setting the default value of the @odata.type property in the schema of derived types.
  • Adds a new convert setting for setting this default value. The default value is true, meaning the default value will always be emitted. If false the value will be set conditionally based on whether the derived type's base type is abstract (and not entity) and is referenced in the properties of a structural property or an action.
  • Updates existing tests and adds a new test to validate the above.

andrueastman
andrueastman previously approved these changes Nov 14, 2022
Copy link
Contributor

@andrueastman andrueastman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking the changes, one last thing

@irvinesunday
Copy link
Contributor Author

thanks for taking the changes, one last thing

From the issue description written by @andrueastman, I understood that we should check whether the type derives from an abstract type alongside the other 2 listed checks, else, we generate the default value by default (as is the current current case). Is this not the expectation?

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking the changes

@irvinesunday irvinesunday merged commit 5952515 into master Nov 17, 2022
@irvinesunday irvinesunday deleted the fix/is/odatatype-default-value branch November 17, 2022 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default presence of odata.type property in generated OpenAPI

4 participants