title: Swagger API errors: reference could not be resolved
body: <p>I'm trying to specify my API data types in swagger 2.0 using yaml, but I'm getting a reference error (see error details at the bottom).</p>
  
  <p>I'm using a nested structure, where the parent object (InvoiceConfigData) contains an array of child objects (ProviderVariantsData). This is the hierarchy of yaml files:</p>
  
  <p>.api/swagger/cfg/InvoiceConfigData.yaml:</p>
  
  <pre><code>required:
    - providerName
    - providerVariants
  properties:    
    providerName:
      type: string
    providerVariants: 
      type: array                      
        items:      
          $ref: "#/definitions/ProviderVariantsData"
  </code></pre>
  
  <p>.api/swagger/cfg/ProviderVariantsData.yaml:</p>
  
  <pre><code>properties: 
    displayName:
      type: string
    cif:
      type: string
    availableTemplates:
      type: array
        items:
        type: string
  </code></pre>
  
  <p>.api/swagger/definitions.yaml:</p>
  
  <pre><code>ProviderVariantsData:
    $ref: ./cfg/ProviderVariantsData.yaml
  InvoiceConfigData:
    $ref: ./cfg/InvoiceConfigData.yaml
  </code></pre>
  
  <p>But I get the following errors:</p>
  
  <pre><code>API Errors:
  
    #/definitions/InvoiceConfigData/$ref: Reference could not be resolved: ./cfg/InvoiceConfigData.yaml
    #/definitions/ProviderVariantsData/$ref: Reference could not be resolved: ./cfg/ProviderVariantsData.yaml
  
  API Warnings:
  
    #/definitions/ProviderVariantsData: Definition is defined but is not used: #/definitions/ProviderVariantsData
  </code></pre>
  
  <p>There's something wrong in the way I reference the ProviderVariantsData, but I can't find what's causing the error. I've tried to flip the order in "definitions.yaml" (InvoiceConfigData above ProviderVariansData) without success.</p>