Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Unresolved reference when converting from OAS 2.0 to RAML 1.0 #73

Open
@benthurley82

Description

@benthurley82

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, one of the types is not being converted correctly and attempting to use the RAML shows there are errors.

e.g. OAS 2.0

  "definitions": {
    "BaseResponse": {
      "type": "object",
      "properties": {
        "errors": {
          "type": "array",
          "xml": {
            "name": "errors",
            "attribute": false,
            "wrapped": false
          },
          "items": {
            "$ref": "#/definitions/LedgerEntry"
          }
        }
      },
      "title": "BaseResponse"
    },
...
    "LedgerEntry": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "severity": {
          "type": "string",
          "enum": [
            "INFO",
            "WARN",
            "VALIDATION",
            "ERROR",
            "FATAL",
            "CONSTRAINT"
          ]
        }
      },
      "title": "LedgerEntry"
    },

Results in RAML 1.0

  LedgerEntry:
    displayName: LedgerEntry
    type: object
    properties:
      code:
        type: string
        required: false
      description:
        type: string
        required: false
      severity:
        enum:
          - INFO
          - WARN
          - VALIDATION
          - ERROR
          - FATAL
          - CONSTRAINT
        type: string
        required: false
...
  BaseResponse:
    displayName: BaseResponse
    type: object
    properties:
      errors:
        xml:
          attribute: false
          wrapped: false
          name: errors
        type: array
        items: "#/definitions/LedgerEntry"
        required: false

Using the API designer in the Anypoint Design Centre I was able to correct the above RAML to the following:

items: LedgerEntry

My expectation is that the RAML is generated without errors.

Thanks
Ben

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions