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

Update URIValueFromNodeDecoder for DeepObject. #125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kstefanou52
Copy link
Contributor

Motivation

As discussed in [Generator] Add support of deepObject style in query params #538, there is a misimplementation of the decodeRootIfPresent method in URIValueFromNodeDecoder. When using the deepObject style, the node for rootValue is correctly empty, containing only the sub-objects.

Without this PR, the tests for Add support of deepObject style in query params #538 are failing.

Modifications

  • Updated the decodeRootIfPresent(_ type:) throws -> T method to ignore whether currentElementAsArray is empty or not.

Result

Test Plan

This PR includes unit tests that validate the change to decodeRootIfPresent(_ type:) throws -> T within Test_Converter+Server as well as in Test_serverConversionExtensions.

### Motivation

As discussed in [[Generator] Add support of deepObject style in query params #538](apple/swift-openapi-generator#538 (comment)), there is a misimplementation of the `decodeRootIfPresent` method in `URIValueFromNodeDecoder`. When using the `deepObject` style, the node for `rootValue` is correctly empty, containing only the sub-objects.

Without this PR, the tests for [Add support of deepObject style in query params #538](apple/swift-openapi-generator#538) are failing.

### Modifications

- Updated the `decodeRootIfPresent(_ type:) throws -> T` method to ignore whether `currentElementAsArray` is empty or not.

### Result

- Enables the tests in the [Generator part of the PR](apple/swift-openapi-generator#538) to pass successfully.

### Test Plan

This PR includes unit tests that validate the change to `decodeRootIfPresent(_ type:) throws -> T` within `Test_Converter+Server` as well as in `Test_serverConversionExtensions`.
@czechboy0
Copy link
Collaborator

@kstefanou52 When reviewing this change I realized we'll need a few more changes here, which I'll look into doing next week. I'll let you know when they're ready.

@kstefanou52
Copy link
Contributor Author

@kstefanou52 When reviewing this change I realized we'll need a few more changes here, which I'll look into doing next week. I'll let you know when they're ready.

Sure! Let me know if you would like some help on this!

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