raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Additional properties and Union types not resolved

Open eleonoraortega opened this issue 8 years ago • 0 comments

With the following example:

#%RAML 1.0
title: DiagnosticReport
version: 1.0
#baseUri: http://xxx/y
baseUri: https://mocksvc.mulesoft.com/mocks/592ebe1d-1922-4439-8520-4395febfd2b6/y

types:
  qPatient:
    properties:
      patient:
    additionalProperties: false
  qCategory:
    properties:
      category:
        enum: [LAB, xxx]
    additionalProperties: false
  qCode:
    properties:
      code:
        type: array
    additionalProperties: false
  qDate:
    properties:
      date:
        type: array
        items: 
          pattern: ^(ge|le|gt|lt)?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])))
    additionalProperties: false
  qPatientPlusCategory:
    type: [qPatient, qCategory]
    additionalProperties: true
  qPatientPlusCategoryPlusCode:
    type: [qPatient, qCategory, qCode]
    additionalProperties: false
  qPatientPlusCategoryPlusDate:
    type: [qPatient, qCategory, qDate]
    additionalProperties: false
  qPatientPlusCategoryPlusCodePlusDate:
    type: [qPatient, qCategory, qCode, qDate]
    additionalProperties: false
/DiagnosticReport:
  get:
    queryString:
      type: qPatientPlusCategory | qPatientPlusCategoryPlusCode | qPatientPlusCategoryPlusDate | qPatientPlusCategoryPlusCodePlusDate
      examples:
        1:
          value:
            patient: abc
            category: LAB
        2:
          value:
            patient: abc
            category: LAB
            date: [2012-01-01, 2017-12-31]
        3: 
          value:
            patient: abc
            category: LAB
            code: [LOINC1, LOINC2]
        4:
          value:
            patient: abc
            category: LAB
            code: [LOINC1, LOINC2]
            date: [gt2012-01-01, le2017-12-31]
    responses:
      200:
        body:
          application/json:
            example:
              msg: Hello world

RAML java parser is taking the properties for the different type as "additional properties"

For instance: In example 3. qPatientPlusCategoryPlusCode value: patient: abc category: LAB code: [LOINC1, LOINC2]

Is resolved as qPatientPlusCategory plus code as additional properties. If additional properties is set to true in qPatientPlusCategory, parser stops complaining

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-77

eleonoraortega avatar Aug 07 '17 17:08 eleonoraortega