Skip to content

APIGateway Model Schema does not work with Join #784

@tomkerswill

Description

@tomkerswill

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions