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

fix: Respect schema names in short FlexNamer #839

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

Conversation

TheAwiteb
Copy link
Contributor

@TheAwiteb TheAwiteb commented Jul 25, 2024

Fixes #833

Changes

In this PR, I addressed the issue where FlexNamer did not respect the schema
name when generating the short name. Previously, FlexNamer incorrectly used
the type_name parameter as the short name in the Force rule. This has been
corrected by using the force_name parameter as the short name in the Force
rule.

Note

This fix only applies to the schema name itself and does not address cases where
the schema name is used as a generic type. Unfortunately, this limitation cannot
be resolved, so please avoid naming your schema if it is intended for use as a
generic type.

Screenshot

This screenshot shows the updated FlexNamer implementation

Before

image

After

image

@TheAwiteb
Copy link
Contributor Author

TheAwiteb commented Jul 25, 2024

Hey @chrislearn, is the test_derive_to_schema_generics test written incorrectly? I noticed that there are aliases for i32 and String, but they are not on the right-hand side of the assertion. The new left-hand side is below. Should I fix the right-hand side, or am I missing something?

{
  "MyI32": {
    "properties": {
      "value": {
        "format": "int32",
        "type": "integer"
      }
    },
    "required": [
      "value"
    ],
    "type": "object"
  },
  "MyObject_u64_": {
    "properties": {
      "value": {
        "format": "int64",
        "minimum": 0,
        "type": "integer"
      }
    },
    "required": [
      "value"
    ],
    "type": "object"
  },
  "MyStr": {
    "properties": {
      "value": {
        "type": "string"
      }
    },
    "required": [
      "value"
    ],
    "type": "object"
  }
}

@TheAwiteb TheAwiteb marked this pull request as draft July 26, 2024 18:12
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.

OAPI : Short FlexNamer doesn't respect schemas name
1 participant