Skip to content

W-13157845: upgrade to AMF 5.3.0 #442

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

Merged
merged 5 commits into from
May 11, 2023
Merged

W-13157845: upgrade to AMF 5.3.0 #442

merged 5 commits into from
May 11, 2023

Conversation

juanchib
Copy link
Contributor

@juanchib juanchib commented May 5, 2023

No description provided.

Comment on lines -266 to -267
} else if (!(shape instanceof NilShape)) {
return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I truly don't remember why this was here

Copy link
Contributor

Choose a reason for hiding this comment

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

what I understand is that it was used for checking that the the union is of array shapes only (including nil), so if there was a shape that was not an array or nil, then you stop the search and return false.

Copy link
Contributor

Choose a reason for hiding this comment

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

That being said, I don't think this code does the same, because if it is a union of an ArrayShape and a NodeShape, it will return true anyway because matches "any match", right?

Copy link
Member

Choose a reason for hiding this comment

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

The original idea of hasAnArrayVariant was that:

// Let's imagine we have a parseType function

// Null doesn't have an array variant
assertFalse(hasAnArrayVariant(parseType("nil")));
assertFalse(hasAnArrayVariant(parseType("nil | nil")));
assertFalse(hasAnArrayVariant(parseType("nil | nil | null")));

// Unions of arrays have an array variant
assertTrue(hasAnArrayVariant(parseType("String[] | Integer[]")));
assertTrue(hasAnArrayVariant(parseType("Integer[] | String[]")));

// Null is ignored in unions of arrays
assertTrue(hasAnArrayVariant(parseType("String[] | Integer[] | nil")));
assertTrue(hasAnArrayVariant(parseType("String[] | nil | Integer[]")));
assertTrue(hasAnArrayVariant(parseType("nil | String[] | Integer[]")));
assertTrue(hasAnArrayVariant(parseType("Integer[] | String[] | nil")));
assertTrue(hasAnArrayVariant(parseType("Integer[] | nil | String[]")));
assertTrue(hasAnArrayVariant(parseType("nil | Integer[] | String[]")));

// Any other type is not ignored in unions of arrays
assertFalse(hasAnArrayVariant(parseType("string | Integer[] | String[]")));
assertFalse(hasAnArrayVariant(parseType("Integer[] | string | String[]")));
assertFalse(hasAnArrayVariant(parseType("Integer[] | String[] | string")));

Why was it like that?

I don't remember

I'll try to remember 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, trying to figured out why

Copy link
Member

Choose a reason for hiding this comment

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

I think it was related to which parameters may or may not be repeatable.

I would test against a parameters with type Integer | String[], Integer | Integer[] and String[] | Integer, etc and see which validations they trigger (or don't trigger) when passed on query params, json bodies and form-data.

Also... a lot of work to try out all that 😪

"expression":{
"language":"text/fhirpath",
"name":"Telemedicine Visit"
"resource": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was something that AMF starts validating correctly

@juanchib juanchib requested review from iglosiggio and dcourtil May 5, 2023 17:29
dcourtil
dcourtil previously approved these changes May 10, 2023
JuanAller
JuanAller previously approved these changes May 11, 2023
@juanchib juanchib dismissed stale reviews from JuanAller and dcourtil via abc828c May 11, 2023 11:49
JuanAller
JuanAller previously approved these changes May 11, 2023
@juanchib juanchib merged commit b5f29ac into main May 11, 2023
@juanchib juanchib deleted the W-13157845 branch May 11, 2023 12:01
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.

4 participants