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

[BUG] failed to transform from cuelang to openapischema when exclusiveMinimum field exists for OpenApiSchema #5971

Closed
sophon-zt opened this issue Dec 1, 2023 · 4 comments · Fixed by #6924
Assignees
Labels
bug kind/bug Something isn't working Stale wontfix This will not be worked on
Milestone

Comments

@sophon-zt
Copy link
Contributor

sophon-zt commented Dec 1, 2023

Describe the bug
A clear and concise description of what the bug is.

test data

// Max number of rows in each audit log file. Log records will be discarded above this number.
test_field_limit?: int & > 0

error log:

failed to unmarshal raw OpenAPI schema to JSONSchemaProps: [error unmarshaling JSON: while decoding JSON: json: cannot unmarshal number into Go struct field JSONSchemaProps.properties.exclusiveMinimum of type bool]

open schema

test_field_limit:
    description: Max number of rows in each audit log file. Log records will be discarded above this number.
    type: integer
    exclusiveMinimum: 0
rds_audit_log_statement_policy:
    description: The policy controlling how the audit log plugin writes  query events to its log file. Supported values are 'ALL' (default), 'UPDATES',  'UPDATES_OR_ERRORS', 'ERRORS' and 'NONE'.
    type: string
    enum:
      - ALL
      - UPDATES
      - NONE
      - ERRORS
      - UPDATES_OR_ERRORS
wait_timeout:
    description: The number of seconds the server waits for activity on a non-interactive TCP/IP or UNIX File connection before closing it.
    type: integer
    minimum: 1
    maximum: 31536000
@sophon-zt sophon-zt added the kind/bug Something isn't working label Dec 1, 2023
@sophon-zt sophon-zt self-assigned this Dec 1, 2023
@sophon-zt
Copy link
Contributor Author

related issue: #5969

@sophon-zt sophon-zt changed the title [BUG] failed to transform from cuelang to openapischema when exclusiveMinimum field [BUG] failed to transform from cuelang to openapischema when exclusiveMinimum field exists Dec 1, 2023
@sophon-zt sophon-zt changed the title [BUG] failed to transform from cuelang to openapischema when exclusiveMinimum field exists [BUG] failed to transform from cuelang to openapischema when exclusiveMinimum field exists for OpenApiSchema Dec 1, 2023
@sophon-zt
Copy link
Contributor Author

This is a cue bug.

Copy link

github-actions bot commented Jan 1, 2024

This issue has been marked as stale because it has been open for 30 days with no activity

@shanshanying
Copy link
Contributor

Seems we need a proper way to convert CUE to Yalm/JSON to JSONSchemaProps.
the encodeded json string from CUE is:
image

And the JSONSchemaProps struct is
image

When converting from JSONObject to JSONSchemaProps, there is a mismatch in fields.
It should convert exclusiveMinimum: 1 (JSON) to exclusiveMinmum: true and Minimum: 1 in JSONSchemaProps.

The CUE community has solved this issued in #cue1. But we still failed to convert values to JSONSchemaProps.

To work-around this bug, we suggested to to use >=, <= instand of >, <.
e.g. max_connections >100 --> max_connections >=101 will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug kind/bug Something isn't working Stale wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants