Issues with defining JsonSchema #20076
Unanswered
dbartholomae
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Hey @dbartholomae, converting this to a discussion. You're setting the type of the const as const schema: JsonSchema = {
type: JsonSchemaType.OBJECT,
properties: {
name: {
type: JsonSchemaType.STRING
}
},
required: ['name']
}
api.addModel('event', {
modelName: 'aanalytivcevent',
contentType: 'application/json',
schema: schema
}) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
When hand-writing a schema where it is defined as
const
and trying to use it in apigateway, TypeScript rejects the schema:Expected Behavior
This should just work
Current Behavior
Reproduction Steps
If the example above is not enough to show the issue, I can create a reproducing repo.
Possible Solution
Change the array into a ReadonlyArray:
https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-apigateway/lib/json-schema.ts#L70
Additional Information/Context
No response
CDK CLI Version
2.20.0
Framework Version
No response
Node.js Version
v16.13.1
OS
Windows 11
Language
Typescript
Language Version
No response
Other information
See #20055 for a related issue
Beta Was this translation helpful? Give feedback.
All reactions