Skip to content

openapi-request-validator-core:3.0.0 - NoSuchMethodError: SchemaRegistry.getSchema(JsonNode) #37

Description

@gabifericean

Problem

openapi-request-validator-core:3.0.0 throws NoSuchMethodError on first use:

java.lang.NoSuchMethodError:
'com.networknt.schema.Schema com.networknt.schema.SchemaRegistry.getSchema(com.fasterxml.jackson.databind.JsonNode)'

java.lang.NoSuchMethodError: 'com.networknt.schema.Schema com.networknt.schema.SchemaRegistry.getSchema(com.fasterxml.jackson.databind.JsonNode)'
	at com.atlassian.oai.validator.schema.SchemaValidator.lambda$new$3(SchemaValidator.java:145)
	at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$0(LocalLoadingCache.java:192)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$0(BoundedLocalCache.java:2767)
	at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1932)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2765)
	at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2756)
	at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:132)
	at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:60)
	at com.atlassian.oai.validator.schema.SchemaValidator.resolveJsonSchema(SchemaValidator.java:265)
	at com.atlassian.oai.validator.schema.SchemaValidator.validate(SchemaValidator.java:241)
	at com.atlassian.oai.validator.interaction.request.RequestBodyValidator.validateRequestBody(RequestBodyValidator.java:94)
	at com.atlassian.oai.validator.interaction.request.RequestValidator.validateRequest(RequestValidator.java:112)
	at com.atlassian.oai.validator.OpenApiInteractionValidator.lambda$validateRequest$2(OpenApiInteractionValidator.java:208)
	at java.base/java.util.function.Function.lambda$andThen$0(Function.java:88)
	at com.atlassian.oai.validator.OpenApiInteractionValidator.validateOnApiOperation(OpenApiInteractionValidator.java:367)
	at com.atlassian.oai.validator.OpenApiInteractionValidator.validateRequest(OpenApiInteractionValidator.java:205)

How to Reproduce

Use:

      <dependency>
            <groupId>com.atlassian.oai</groupId>
            <artifactId>openapi-request-validator-core</artifactId>
            <version>3.0.0</version>
            <scope>compile</scope>
        </dependency>

Then run any test that validates responses:

OpenApiInteractionValidator validator = OpenApiInteractionValidator.createForSpecificationUrl("spec.yaml").build();
validator.validateResponse(path, method, response); // FAILS HERE

Root Cause
Method SchemaRegistry.getSchema(JsonNode) doesn't exist in any version of com.networknt:json-schema-validator (tested 1.0.84, 1.2.0, 1.3.2, 1.4.1, 1.5.3, 3.0.6)

Downgrade to swagger-request-validator-core 2.46.1 (works perfectly).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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