phoenixnap / springmvc-raml-plugin

Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Apache License 2.0
136 stars 84 forks source link

Deeper imports not considered #291

Closed stojsavljevic closed 5 years ago

stojsavljevic commented 5 years ago

When we have a chain of libraries where 1st uses 2nd, 2nd uses 3rd and so on some data types can't be found. Data types that can't be found are imported in 'deeper' libraries. Example: main.raml:

#%RAML 1.0
title: Library reference issue
version: 1.0
baseUri: /

uses:
  sales: sales.raml

/sales:
  get:
    responses:
      200:
        body:
          application/json:
            type: sales.Sales[]

sales.raml:

#%RAML 1.0 Library

uses:
  productConfiguration: productConfiguration.raml

types:
  Sales:
    properties:
      id: string
      contractNumber?: string
      productConfiguration:
        type: productConfiguration.ProductConfiguration[]

productConfiguration.raml:

#%RAML 1.0 Library

uses:
  price: price.raml

types:
  ProductConfiguration:
    properties:
      id: string
      productName: string
      productPrice:
        type: price.Price

price.raml:

#%RAML 1.0 Library

types:
  Price:
    properties:
      basePrice: number
      salePrice: number

Error:

[ERROR] Failed to execute goal com.phoenixnap.oss:springmvc-raml-plugin:2.0.4:generate-springmvc-endpoints (generate-springmvc-controllers) on project springmvc-test: Execution generate-springmvc-controllers of goal com.phoenixnap.oss:springmvc-raml-plugin:2.0.4:generate-springmvc-endpoints failed: Data type Price can't be found! -> [Help 1]