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 réponse
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
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions