cloudtools / cloudtools/troposphere

APIGateway Model Schema does not work with Join

Open
#784 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Hi

I have a model schema, and want to use Join within the schema to pull in the correct absolute reference to another model schema.

(Note - to simplify, I have actually just used Join here to join some strings to make up the URL).

What seems to happen is that Troposphere converts the JSON into a string, but doesn't like the Join function.

`test_schema = t.add_resource(Model(
"test",
Name = "test",
ContentType="application/json",
RestApiId=Ref(testApi),
Schema={
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "test",
"id": "/test",
"type": "object",
"properties": {
"_id": {"type": "string"},
"trades": {
"type": "array",
"items": [{"$ref": Join("",["https://apigateway.amazonaws.com/restapis/", "abc123456", "/models/testreference"] ) } ]
}
}
}
))`

I've also tried using the "Fn::Join" native Cloudformation JSON, and that does allow the JSON file to be built without error, but escapes the Fn::Join into a string, so that when CloudFormation runs, it just treats that as the reference without doing the join.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.