ERROR: $ref Invalid model specified: [Model reference must be in canonical form] [API Gateway: Models]

0

A 2018 tutorial shows this as working (I'm new to AWS), but I get the following error when using $ref in API Gateway > Models:

**ERROR: Invalid model specified: [Model reference must be in canonical form] **

{
    "type": "array",
    "items":{
      "$ref":"https://api.gateway.amazonaws.com/restapis/evwngv01/models/MusicItem" 
    }  
}

From the 2018 Tutorial: Enter image description here

I checked these docs, tried using ""Ref" instead, but that didnt work. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html

Thanky ou.

1 Answer
2

It appears the URL is not in the correct format in your ref. The format is:

"$ref": "https://apigateway.amazonaws.com/restapis/{restapi_id}/models/{model_name}"

Note, that there is a '.' between api and gateway that shouldn't be there. Also check that the ID of your REST API is correct, is 'evwngv01' the ID of the REST API you have created.

"$ref":"https://api.gateway.amazonaws.com/restapis/evwngv01/models/MusicItem"

AWS
Steve
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions