-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APIGateway Model Schema does not work with Join #784
Comments
@tomkerswill Have you tried putting the Join statement at the beginning of your JSON to include the entire JSON document in the Join statement? You would have the escape your quotations in the JSON document.
Not sure it would work.... Just an idea |
Hi, did anyone ever get this to work? It's been super painful since we only find out if it isn't working via attempted creations (vs just rendering/validating the template) even once the Join is serializable. A working example would be much appreciated! |
I think this has to do with the validation step (apigateway.Model.validate()) performing a json.dumps() on the entire Schema attribute when it's a dictionary. If the json_checker leaves the troposphere types (like Ref or Join) alone, troposphere is able to render the template. I'm hoping to address this with #946. From the failed test condition I'm seeing right now from test_cloudwatch.py, it seems cloudwatch.Dashboard would exhibit the same issue. |
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.
The text was updated successfully, but these errors were encountered: