$ref not allowed under schemas

Issue #263 new
Former user created an issue

Hello,

Trying to move some common schemas to other .yaml file to gain some "modularity" and that a single .yaml would not grow too big. When reading the .yaml atlassian swagger validator complains following:

[info] 1) Error injecting constructor, com.atlassian.oai.validator.OpenApiInteractionValidator$ApiLoadException: Unable to load API spec from provided URL or payload: 
[info] - attribute components.schemas.$ref is not of type object 
[info] - attribute components.schemas.Schema name $ref doesn't adhere to regular expression ^[a-zA-Z0-9.-_]+$ 
[info] [info] 1 error 
[info] at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226) 
[info] at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053) 
[info] at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086) 
[info] at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:435) 
[info] at play.api.inject.ContextClassLoaderInjector.$anonfun$instanceOf$3(Injector.scala:117) 
[info] at play.api.inject.ContextClassLoaderInjector.withContext(Injector.scala:125) 
[info] at play.api.inject.ContextClassLoaderInjector.instanceOf(Injector.scala:117)

And here's the yaml snippet of the failing place: schemas: $ref: './dataset.models.yaml#/schemas'

It seems that under schemas it is expected name only and $ref can't be used as it fails having illegal characters. Previewing the .yaml with swagger tools this is ok so this should be valid use case to use $ref here.

Hope this is simple enough explanation. Please ask for more info if needed.

Comments (2)

  1. ville levä

    I wasn’t logged in when I created this issue. Also issue text was formatted to not so readable form. I hope below example of failing part shows ok. :)

    schemas:
      $ref: './dataset.models.yaml#/schemas'
    

  2. Log in to comment