x-nullable not working for response primitives
See original GitHub issueHello,
I’m working on an API with Swashbuckle and Autorest for it’s clients. Currently all the responses that are primitive types (int, bool) become nullable (int? or bool?), but they shouldn’t be like that.
I applied a filter before in order to correct the same issue on my entities with x-nullable, but for some reason is not working on the return types.
Is there any other way to achieve this?
Example code:
/api/Alert/Remove:
delete:
tags:
- Alert
operationId: AlertRemove
consumes: []
produces:
- application/json
parameters:
- name: id
in: query
required: true
type: string
format: uuid
responses:
'200':
description: Success
schema:
type: boolean
x-nullable: false
Autorest generated client method
public static bool? AlertRemove(this IAlertsClient operations, System.Guid id)
{
return operations.AlertRemoveAsync(id).GetAwaiter().GetResult();
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
AutoRest generating nullable boolean for method return type
According to this issue on autorest GitHub: x-nullable not working for response primitives, there is an issue with the autorest generators ...
Read more >Add support for 'null' values in response. - Bitbucket
I found no way to overcome this. As a solution I see either supporting one of the 'x-nullable' kind of attributes in spec...
Read more >543304 – @NonNull produces an error with arrays of primitives
No, I am really using javac from Java 7 and Lombok's NonNull annotation. Here is a test class which compiles with Java 7...
Read more >Schema generation rules · GitBook - Goswagger.Io
Here are the rules that turn something into a pointer. structs; x-nullable , x-isnullable : explicit override to accept null values (otherwise not...
Read more >AutoRest Extensions for OpenAPI 2.0 - Azure documentation
This is not a good choice when the parameter is provided from a source where the ... multiple primitive parameters into a composite...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s possible that for responses that are primitive, we didn’t support
x-nullable
.I’ll have to dig into it.
Hi, I just wanted to check if this was on Autorest’s roadmap for the next months, because I’m currently using the last version of the --v3 generator and still the primitive types are generated as nullables.