-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix(service-spec): the spec treats any nested anyOf
or oneOf
as a union type
#1269
Conversation
Signed-off-by: github-actions <github-actions@github.com>
…dk-service-spec into comcalvi/union-errors
Signed-off-by: github-actions <github-actions@github.com>
branch 'comcalvi/union-errors' of github.com:cdklabs/awscdk-service-spec into comcalvi/union-errors
This breaks valid union types... |
Old Union Handling: API elements with incompatible changes:
New Union Handling: API elements with incompatible changes:
|
and this third method of handling them:
|
it shrinks...
|
…mcalvi/union-errors
pulled from main:
|
Fixed it back to
|
|
|
@aws-cdk/aws-service-spec: Model database diff detected
|
Added a |
@@ -15,14 +17,18 @@ export namespace jsonschema { | |||
|
|||
export type EmptyObject = Record<string, never>; | |||
|
|||
export function isAnyType(x: Schema): x is AnyType { | |||
export function isAnyType(x: Schema | CommonTypeCombinatorFields): x is AnyType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is CommonTypeCombinatorFields
needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the entries in a oneOf
list can be a CommonTypeCombinatorFields
, and we check those entries with isAnyType
below.
const requiredProps = Object.entries(resource.properties) | ||
.filter(([_, value]) => value.required) | ||
.map(([name, _]) => name); | ||
expect(requiredProps.length).toBe(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it 0 as the expected value? Type
is required no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type
is on the SomeConfigurationProp
type, it's not a propery of the AWS::OneOf::Required
resource.
The only property that could be required is DataSourceConfiguration
, which is not marked required.
This doesn't look right to me according to the cfn doc. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-connection.html#cfn-events-connection-authparameters
|
I checked this, the docs are wrong; you can't deploy the resource without specifying the property.
|
Improves handling of
oneOf
clauses.oneOf
is able to define entire types:They can also contain references:
Previously, we were not processing these correctly.