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 Antwort
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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen