2

I have such a component in swagger.json (OpenAPI version: "3.0.1")

"ids": {
  "type": "array",
  "items": {
    "type": "string",
    "format": "uuid",
    "nullable": true,
    "x-nullable": true
  },
  "nullable": true,
  "x-nullable": true
}

With the OpenAPI generator, I intend to create such a type in C#:

List<Guid?>?

However, as a result, it generates

List<Guid>?

I traced the models, to find the dataType as follows:

"dataType" : "List<Guid>"

And IsNullable is true

"isNullable" : true

For its items, the dataType is "Guid" and isNullable is true

"dataType" : "Guid",
"isNullable" : true,

The Mustache statement is

{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}}

so we can tell that the '?' actually comes from NullConditionalProperty.

Is it supported that the array items can be nullable for the C# language?

2
  • ”Is it supported that the array items can be nullable for C# language?” - yes Commented May 12 at 10:32
  • 1
    Thanks for the answer but I'm asking it for the OpenAPI generator. FYI. Maybe I need to rephrase it as 'Is it supported that the array items can be nullable for C# language generator?' Commented May 13 at 0:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.