Error in RAML file referencing a schema


#1

I have a Raml file that is referencing a json schema, I had used the same schema and raml fle couple of months back, it was working fine without errors, however now I am seeing an error saying that schemas property must be an array.


#2

what designer are you using?


#3

I am using the API Designer from the anypoint platform.


#4

This it the link
https://anypoint.mulesoft.com/apiplatform

I created an account and started using it.

I can test the raml if the schemas are defined inline , but not able to run or view the schemas if defined externally in another raml file and reference them .

Thanks

Raj


#5

This is how I have referenced the raml file
schemas:

  • include createpreorderquote-api-schemas.raml

The external file that has the schemas starts something like this.

  • preOrderQuoteRequest: |
    {
    “type”: “object”,
    “properties”: {
    “realmID”: {
    “type”: “string”,
    “description”: “the company Identifier in OII (also the customerAccountID in EBP). If realmID is provided, and an address is not provided, this service will retrieve the address from OII identity service.*MDR is to give either realmID or country. If country given (or found in OII) is US or CA, then state is also mandatory.”
    },
    “address”: {
    “type”: “object”,
    “description”: “the address to be used in tax calculation. address is required if realmID is not provided. If both address and realmID are provided, realmID will be ignored and address will be used for tax calculation.*MDR is to give either realmID or country. If country given (or found in OII) is US or CA, then state is also mandatory.”,
    “properties”: {
    “addressLine1”: {
    “type”: “string”,
    “description”: “First address line associated with the address to be used for tax calculation”
    },
    “addressLine2”: {
    “type”: “string”,
    “description”: “Optional second address line”
    },
    “addressLine3”: {
    “type”: “string”,
    “description”: “Optional third address line”
    },
    “addressLine4”: {
    “type”: “string”,
    “description”: “Optional fourth address line”
    },
    “city”: {
    “type”: “string”,
    “description”: “”
    },
    “stateOrProvince”: {
    “type”: “string”,
    “description”: “*MDR: If country given (or found in OII) is US or CA, then state is also mandatory.”
    },
    “postalCode”: {
    “type”: “string”,
    “description”: “”
    },
    “country”: {
    “type”: “string”,
    “description”: "country 2 letter ISO code *MDR: country is mandatory if realmID is not provided ",
    “required”:“true”
    }
    }
    },
    “transactionLine”: {
    “type”: “array”,
    “required”:“true”,
    “items”: [
    {
    “type”: “object”,
    “properties”: {
    “offerID”: {
    “type”: “integer”,
    “description”: “the offerID which the customer is buying, opting-in, upgrading, or re-subscribing”,
    “required”:“true”
    },
    “subscriptionID”: {
    “type”: “integer”,
    “description”: “identifies the customer’s current subscription, so that any pro-ration, or credit, may be accounted for in the quote.”
    }
    }
    }
    ]
    }
    },
    “required”: [
    “offerID”,
    “country”
    ]
    }

#6

I think the error is that you have a “required” attribute within individual property types which is taking the string value “true”. AFAIK JSON Schema only allows you to indicate mandatory properties at the “object” level, in which case the value must be an array of strings (property names).