Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate openapi3.Schema failed when Schema.Type is empty string #1015

Closed
EmilGeorgiev opened this issue Oct 2, 2024 · 2 comments
Closed

Comments

@EmilGeorgiev
Copy link

Fist of all thank you for this great library, I really like it. I have one question:

I am using the version 0.123.0 and the Schema's method validate contains this peace of code

:

schemaType := schema.Type
switch schemaType {
case "":
case TypeBoolean:
case TypeNumber:
...
case TypeInteger:
...
case TypeString:
...
case TypeArray:
...
case TypeObject:
default:
return stack, fmt.Errorf("unsupported 'type' value %q", schemaType)
}

I updated the library to the version 0.127.0 and in the same method this peace of code is a little bit different. The case for the empty string is missing

switch schemaType {

switch schemaType {
case TypeBoolean:
case TypeNumber:
	...
case TypeInteger:
	....
case TypeString:
		      ....
case TypeArray:
	...
case TypeObject:
default:
	return stack, fmt.Errorf("unsupported 'type' value %q", schemaType)
}

Is this intentional or it is a bug?

@AriehSchneier
Copy link
Contributor

It was changed in this PR: #912

@fenollp
Copy link
Collaborator

fenollp commented Oct 7, 2024

Indeed this change was overlooked and should have been mentioned in the README's breaking changes section.

The change is however correct IMO.

Feel free to reopen if you want to pursue discussion.

@fenollp fenollp closed this as completed Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants