Skip to content

Angular schema nullability definitions incorrectly done #2092

@jonimake

Description

@jonimake

I'm using orval 7.9.0 and I have the following component schema:

"components": {
	"schemas": {
	   "TestDto":{
		  "type":"object",
		  "required":[
			 "Foo",
			 "Bar"
		  ],
		  "properties":{
			 "Foo":{
				"type":"string"
			 },
			 "Bar":{
				"nullable":true,
				"type":"string"
			 },
			 "Foobar":{
				"nullable":true,
				"type":"string"
			 }
		  }
	   }
	}
}

and the generated model with angular client output is as such:

export interface TestDto {
  Foo: string;
  /** @nullable */
  Bar: string;
  /** @nullable */
  Foobar?: string;
}

As you can see the Bar and Foobar properties both have the "nullable" comment (but Bar surprisingly isn't nullable nor optional at all) and Foobar is just an optional property.

If I generate with zod client output I get what I expected:

export interface TestDto {
  Foo: string;
  /** @nullable */
  Bar: string | null;
  /** @nullable */
  Foobar?: string | null;
}

Is there any specific reason for why angular generation works this way or is it just a bug?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions