Skip to content

Unknown keyword openapi when creating a schema of an openAPI 3.0 file #1205

@LennysLounge

Description

@LennysLounge

Im trying to validate a json playload against a schema defined in a openAPI 3.0 file.
I was following this: https://github.com/networknt/json-schema-validator/blob/1.5.9/doc/openapi.md

When i do this and create a JsonSchema for my file i get a few "unknown keyword" warnings:

2025-10-24 12:07:40,920 WARN [main] com.networknt.schema.UnknownKeywordFactory:37 Unknown keyword openapi - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword or if it should generate annotations AnnotationKeyword 2025-10-24 12:07:40,929 WARN [main] com.networknt.schema.UnknownKeywordFactory:37 Unknown keyword info - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword or if it should generate annotations AnnotationKeyword 2025-10-24 12:07:40,930 WARN [main] com.networknt.schema.UnknownKeywordFactory:37 Unknown keyword security - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword or if it should generate annotations AnnotationKeyword 2025-10-24 12:07:40,930 WARN [main] com.networknt.schema.UnknownKeywordFactory:37 Unknown keyword servers - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword or if it should generate annotations AnnotationKeyword 2025-10-24 12:07:40,930 WARN [main] com.networknt.schema.UnknownKeywordFactory:37 Unknown keyword paths - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword or if it should generate annotations AnnotationKeyword 2025-10-24 12:07:40,930 WARN [main] com.networknt.schema.UnknownKeywordFactory:37 Unknown keyword components - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword or if it should generate annotations AnnotationKeyword 

I would like to fix those warnings to keep my log clean if possible.

I also tried loading a 3.0 meta schema from the class path like this:

 JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V4, builder -> builder .defaultMetaSchemaIri("classpath:oas/3.0/schema/2024-10-18") .metaSchema(JsonMetaSchema.builder("classpath:oas/3.0/schema/2024-10-18").build())); JsonSchema baseSchema = factory.getSchema(SchemaLocation.of("classpath:openapi.yaml")); 

but that also now gives the "items" keyword as unknwon.

I dont really know what im doing wrong or what i need to do to fix this.

Lib version: 1.5.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions