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

Support struct arguments with all optional fields #156

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

Conversation

bestbeforetoday
Copy link
Member

@bestbeforetoday bestbeforetoday commented Nov 29, 2024

Transaction functions with struct argument that have all their fields as JSON optional causes a parsing error on the chaincode metadata:

components.schemas.Args.required: Array must have at least 1 items

Having no required fields causes the required property to be an empty array. Draft 4 of the JSON schema specification requires string arrays to contain at least one element, so an error occurs.

This change modifies the JSON description of the ObjectMetata Required property so that it is omitted when empty.

Closes #154.

@bestbeforetoday bestbeforetoday marked this pull request as ready for review November 29, 2024 23:38
@bestbeforetoday bestbeforetoday requested a review from a team as a code owner November 29, 2024 23:38
@bestbeforetoday bestbeforetoday enabled auto-merge (squash) November 29, 2024 23:38
Transaction functions with struct argument that have all their fields as
JSON optional causes a parsing error on the chaincode metadata:

    components.schemas.Args.required: Array must have at least 1 items

Having no required fields causes the `required` property to be an empty
array. Draft 4 of the JSON schema specification requires string arrays
to contain at least one element, so an error occurs.

This change modifies the JSON description of the ObjectMetata `Required`
property so that it is omitted when empty.

Signed-off-by: Mark S. Lewis <[email protected]>
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.

Reflected contract schema invalid for all optional arguments
1 participant