Skip to content

Conversation

@benjamin-confino
Copy link
Member

@benjamin-confino benjamin-confino commented Dec 2, 2025

ZOS has their own non-standard roles attribute, this adds support for merging it between multiple OpenAPI docs.

fixes #33571

@benjamin-confino
Copy link
Member Author

benjamin-confino commented Dec 2, 2025

!build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link
Member

LibbyBot commented Dec 2, 2025

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 10 FAT files were changed, added, or removed.

  • Check that the build did not break the affected FAT suite(s).

  • 1 product code files were changed.

  • Please describe in a separate comment how you tested your changes.

@benjamin-confino benjamin-confino changed the title 33571 zos connect 33571 support merging zos connect's OpenAPI extension between multiple docs Dec 3, 2025
Copy link
Member

@Azquelt Azquelt left a comment

Choose a reason for hiding this comment

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

This all looks good 👍

We do have unit tests for MergeProcessor in the io.openliberty.microprofile.openapi.2.0.internal_test project. There's some slight hackiness to run the same tests on mpOpenAPI-2.0 and 4.0, you have to run them from the MergeTests suite but it should be quicker to set up and run than adding FAT tests.

There are a few more tests I think we should add, these could just be unit tests:

  • two apps with conflicting x-ibm-zcon-roles-allowed and a third app without x-ibm-zcon-roles-allowed
  • one app with x-ibm-zcon-roles-allowed and a second app without x-ibm-zcon-roles-allowed
    • In this case I think x-ibm-zcon-roles-allowed should still be moved under the operations (which I don't think the current code will do)

Comment on lines 50 to 51
@RunWith(FATRunner.class)
public class ZOSConnectExtensionTest {
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 this should be a FULL mode test (especially if we add unit tests)

@benjamin-confino
Copy link
Member Author

benjamin-confino commented Dec 3, 2025

!build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link
Member

LibbyBot commented Dec 3, 2025

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 9 FAT files were changed, added, or removed.

  • Check that the build did not break the affected FAT suite(s).

  • 5 unit test files were changed.

  • Check that the build did not break the affected unit test suite(s).

  • 1 product code files were changed.

  • Please describe in a separate comment how you tested your changes.

private static boolean isZConRolesAllowedIdentical(List<InProgressModel> models) {
List<Object> zconExtensions = models.stream().map(d -> d.model.getExtensions())
.filter(Objects::nonNull).map(e -> e.get("x-ibm-zcon-roles-allowed")).collect(toList());
return models.size() == zconExtensions.size() && allEqual(zconExtensions, ModelEquality::equals);
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this return false if there are no zcon roles in any model?

Copy link
Member Author

@benjamin-confino benjamin-confino Dec 4, 2025

Choose a reason for hiding this comment

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

Looking closer, I think yes, but only if at least one model has >=1 extensions other than x-ibm...

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.

mpOpenAPI does not correctly merge x-ibm-zcon-roles-allowed

3 participants