Skip to content

Fix discriminator initialize#2737

Merged
msyyc merged 2 commits intomainfrom
fix-discriminator-initialize
Aug 1, 2024
Merged

Fix discriminator initialize#2737
msyyc merged 2 commits intomainfrom
fix-discriminator-initialize

Conversation

@msyyc
Copy link
Copy Markdown
Member

@msyyc msyyc commented Aug 1, 2024

fix #2735

{% endif %}

{% if not model.internal and serializer.init_line(model) %}
{% set need_init = (not model.internal) and (serializer.init_line(model) or model.discriminator)%}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For model which only has discriminator, we shall also generate __init__ otherwise initialization of model will report error.

@msyyc msyyc marked this pull request as ready for review August 1, 2024 04:50
@msyyc msyyc merged commit 3b7247e into main Aug 1, 2024
@msyyc msyyc deleted the fix-discriminator-initialize branch August 1, 2024 05:12
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.

TypeSpec to Python emitter bug when emitting base/derived models

1 participant