webapi-parser icon indicating copy to clipboard operation
webapi-parser copied to clipboard

Property 'format' not supported in a RAML 1.0 shape node

Open benthurley82 opened this issue 5 years ago • 1 comments

I have been using this API to convert an API spec from OAS 2.0 to RAML 1.0 like so.

    WebApiDocument doc = (WebApiDocument) Oas20.parse(oas20).get();    
    raml10 = Raml10.generateString(doc).get();

However, the resulting RAML has a number of errors, one of these is that any Date type attributes have the error from the title. "Property 'format' not supported in RAML 1.0 shape node"

e.g. OAS 2.0

      "properties": {
        "dateOfBirth": {
          "type": "string",
          "format": "date",
          "example": "1977-12-27",
          "description": "Date of birth"
        },

Results in RAML 1.0

    properties:
      dateOfBirth:
        description: Date of birth
        example: 1977-12-27
        type: date-only
        format: date
        required: false

My OAS 2.0 is automatically generated and checking the docs it looks to be perfectly valid. https://swagger.io/specification/#dataTypes

If I import the OAS into Anypoint Design Centre, then publish to exchange, then export as RAML I get the following instead which doesn't give errors. I guess this is how the conversion should look.

            properties:
              dateOfBirth:
                description: Date of birth
                example:
                  strict: false
                  value: 1977-12-27
                type: date-only
                required: false

My expectation is that the RAML be generated without errors.

Thanks Ben

benthurley82 avatar Mar 05 '20 15:03 benthurley82

Hi @benthurley82.

Thanks a lot for reporting this issue! It looks like the issue comes from our dependency lib. I've reported the issue to that lib team.

https://github.com/aml-org/amf/issues/583

postatum avatar Mar 06 '20 08:03 postatum