-
Notifications
You must be signed in to change notification settings - Fork 1
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
openapi validation question #95
Comments
Yes, I think it should report that error. I will look at it. |
For me validating your file I get
It complains about this invalid ref: This corresponds to the error you expect. I guess the other tools inlines it reports a few more errors but they are all related to the error above. I should probably filter out the other errors. Here is the code I'm using (it is kotlin test code but hopefully easy enough to understand) import io.kotest.core.spec.style.StringSpec
import io.openapiprocessor.jackson.JacksonConverter
import io.openapiprocessor.jsonschema.reader.UriReader
import io.openapiprocessor.jsonschema.schema.DocumentLoader
import io.openapiprocessor.jsonschema.schema.DocumentStore
import io.openapiprocessor.jsonschema.schema.SchemaStore
import io.openapiprocessor.jsonschema.validator.Validator
import io.openapiprocessor.jsonschema.validator.ValidatorSettings
class ValidateSpec: StringSpec({
"validate openapi" {
val documents = DocumentStore()
val loader = DocumentLoader(
UriReader(),
JacksonConverter()
)
val parser = OpenApiParser(documents, loader)
val result = parser.parse("/v30/openapi-95.json")
val store = SchemaStore(loader)
store.registerDraft4()
val validator = Validator()
val valid = result.validate(validator, store)
val errors = result.validationErrors
val builder = ValidationErrorTextBuilder()
for (error in errors) {
println(builder.getText(error))
}
}
)} |
what happen if you don't use "registerDraft4"?
|
Yes. The register just avoids a network call. It adds the draft-4 json schema from the jar resources. Without the register it will download the json schema. |
i am sorry to bother you again... but if the enable draf4 just avoid network calls, then, why this snippet validate?
strangely if i remove the comment // store.registerDraft4 i got the exception |
Yes, strange indeed. Using your code works for me. With or without the register using your example api. One difference is that I'm using If you can create a minimal working project that reproduces the issue I could check what is going. |
hi i am trying to validate an openapi 3 file, json format,
using other tools i got
{"errors":[{"code":400,"message":"Malformed OAS3 document: attribute components.schemas.Schema name ResponsePayloadByte[] doesn't adhere to regular expression ^[a-zA-Z0-9\.\-_]+$"}
and also this stuff
https://quobix.com/vacuum/
return some validation error.
if i try using openapi-parser lib inside a java app, i don't get any validation error, the file is correctly parsed and it work fine.
am i missing anything? shouldn't it fail?
i am attaching file that give error
thanks
PFM_User_Dots.json
The text was updated successfully, but these errors were encountered: