-
Notifications
You must be signed in to change notification settings - Fork 54
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
Incorrect Type Validation for spec
Field: Interprets Numeric Field as String
#191
Labels
Comments
I am unable to reproduce your issue with latest tagged release (v0.24) The following repro test sucessfully validates both types of input. But perhaps there is something I didn't get correctly.
go test -v -run 191
=== RUN TestSchemaValidator_Issue191
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/string_should_validate_against_schema
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/string_should_validate_against_schema/validate_with_pure_jsonschema
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/string_should_validate_against_schema/validate_with_swagger_flavor_of_jsonschema
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/integer_should_validate_against_schema
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/integer_should_validate_against_schema/validate_with_pure_jsonschema
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/integer_should_validate_against_schema/validate_with_swagger_flavor_of_jsonschema
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/float_should_NOT_validate_against_schema
=== RUN TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/float_should_NOT_validate_against_schema/do_not_validate_with_pure_jsonschema
--- PASS: TestSchemaValidator_Issue191 (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/string_should_validate_against_schema (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/string_should_validate_against_schema/validate_with_pure_jsonschema (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/string_should_validate_against_schema/validate_with_swagger_flavor_of_jsonschema (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/integer_should_validate_against_schema (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/integer_should_validate_against_schema/validate_with_pure_jsonschema (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/integer_should_validate_against_schema/validate_with_swagger_flavor_of_jsonschema (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/float_should_NOT_validate_against_schema (0.00s)
--- PASS: TestSchemaValidator_Issue191/with_anyOf_schema_specifying_string_or_number/float_should_NOT_validate_against_schema/do_not_validate_with_pure_jsonschema (0.00s)
PASS
ok github.com/go-openapi/validate 0.005s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
When validating OpenAPI schemas using the
github.com/go-openapi/validate v0.20.2
package, a numeric field within a nested structure incorrectly fails validation when its type is specified to be any of string or integer.when I try to set:
Error Example:
of course it works fine with
the schema in the crd:
The text was updated successfully, but these errors were encountered: