You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The problem happens when trying to create an Angular Service from a Python WebApi.
The issue is presented specifically when a POST method receives a payload, which contains a native type like STR, but this type is expected to be nullable.
The issue is not present when the properties are not nullable.
More details:
This is the code in Python, the entity (payload) to use in the POST method.
It is very simple, but check on the conversation_Id that in particular is marked as nullable.
class Prompt(BaseModel):
prompt: str
conversation_id: str | None = None
This is the generated class for an Angular Service.
Instead of having a conversation_Id nullable, it creates a class for Conversation_Id, which is not expected, causing Angular to create instances for a simple value.
export class Conversation_id {
[key: string]: any;
init(_data?: any) {
if (_data) {
for (var property in _data) {
if (_data.hasOwnProperty(property))
this[property] = _data[property];
}
}
}
Version used
Always LATEST on every run. call npm install -g nswag
To Reproduce
In python API, create any post endpoint which receives a basic entity.
Ensure the entity has a nullable basic type, like str.
Generate the Service for angular with the following configuration provided int he section "Additional Context"
Check the service generated, the conversationID instead of being a property, got created as a class.
Expected behavior
The conversationID should be created as a property, not a class.
The ConversationID should be nullable.
The Nullable phydantic model should be understood to consider nullables properly.
Describe the bug
The problem happens when trying to create an Angular Service from a Python WebApi.
The issue is presented specifically when a POST method receives a payload, which contains a native type like STR, but this type is expected to be nullable.
The issue is not present when the properties are not nullable.
More details:
This is the code in Python, the entity (payload) to use in the POST method.
It is very simple, but check on the conversation_Id that in particular is marked as nullable.
This is the generated class for an Angular Service.
Instead of having a conversation_Id nullable, it creates a class for Conversation_Id, which is not expected, causing Angular to create instances for a simple value.
Version used
Always LATEST on every run.
call npm install -g nswag
To Reproduce
Expected behavior
The conversationID should be created as a property, not a class.
The ConversationID should be nullable.
The Nullable phydantic model should be understood to consider nullables properly.
Additional context
Add any other context about the problem here.
No further comments.
The text was updated successfully, but these errors were encountered: