Skip to content
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

W-10736116: fix transformation for array with any type items #1324

Merged
merged 1 commit into from
Mar 2, 2022

Conversation

looseale
Copy link
Contributor

@looseale looseale commented Mar 2, 2022

No description provided.

@@ -34,11 +32,12 @@ case class PropertyShapeTransformer(property: PropertyShape, ctx: ShapeTransform
propertyMapping
}

private def transformArray(array: ArrayShape) = {
private def transformArray(array: ArrayShape): Unit = {
propertyMapping.withAllowMultiple(true)
array.items match {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just call the root schema transformation here? A possible blocker is that we don't accept ScalarShapes as roots but can this be a possible case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is the problem to call the root. Also calling the root transformation will extract the mapping to a declaration, for scalars this makes no sense.

@@ -34,11 +32,12 @@ case class PropertyShapeTransformer(property: PropertyShape, ctx: ShapeTransform
propertyMapping
}

private def transformArray(array: ArrayShape) = {
private def transformArray(array: ArrayShape): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about array of arrays ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the previous. We should accept it at root level, because we need to extract it to a declaration with the current behavior. I will report another issue to support this, it is not trivial to refactor this.

@@ -0,0 +1,20 @@
#%Dialect 1.0
nodeMappings:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have tests for other types of array types ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the previous one. For scalars and objects is tested, no specifical tests but tested in others.

@tomsfernandez tomsfernandez self-requested a review March 2, 2022 16:06
@looseale looseale merged commit 5eef249 into develop Mar 2, 2022
@looseale looseale deleted the W-10736116 branch March 2, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants