Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Dear Community,

How do you write an optional object into schema so that openapi-python-client will accept it? There are two ideas here

Either

	"member_region": { "type": ["string", "null"] }

Or

	"member_region": {
		"anyOf": [
			{ "type": "string" },
			{ "type": "null" },
		] 
	}

Neither are accepted. Is it just that openapi-python-client does not support this presently? The error message that comes out for anyOf suggests this:

member_region -> anyOf -> 1 -> type
value is not a valid enumeration member; permitted: 'string', 'number', 'integer', 'boolean', 'array', 'object' 

Yes, it can be string or boolean ... anything except string or null.
Should null be supported here?

Thanks in advance,

David

You must be logged in to vote

The methods you’re describing are for OpenAPI 3.1, which is not supported yet. There is a branch in #856 which is adding support for this, if you want to test it out, I’d appreciate it!

For now, only the 3.0 method of adding "nullable": true is supported.

Replies: 1 comment · 1 reply

Comment options

The methods you’re describing are for OpenAPI 3.1, which is not supported yet. There is a branch in #856 which is adding support for this, if you want to test it out, I’d appreciate it!

For now, only the 3.0 method of adding "nullable": true is supported.

You must be logged in to vote
1 reply
@david-dotorigin
Comment options

Thank you!!!

Answer selected by david-dotorigin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.