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

invalid schema #73

Open
teto opened this issue Dec 30, 2022 · 1 comment
Open

invalid schema #73

teto opened this issue Dec 30, 2022 · 1 comment

Comments

@teto
Copy link

teto commented Dec 30, 2022

I tried to leverage some automation on my openapi spec but they all failed because of errors in the schema:

Semantic error at components.schemas.BaselineCheck_'HasCase_PhysicalUnit
Component names can only contain the characters A-Z a-z 0-9 - . _
Semantic error at components.schemas.BaselineDescriptor_'CategoricalDescriptor
Component names can only contain the characters A-Z a-z 0-9 - . _

also I have names like "PlayerPoly_(PointG_Int)" .

I've tried to add some tests and a fix doing:

...
  , datatypeNameModifier = conformDatatypeNameModifier
...

-- | Adhere to spec https://www.rfc-editor.org/rfc/rfc3986#section-3.1 
-- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
conformDatatypeNameModifier :: String -> String
conformDatatypeNameModifier = 
  foldl (\acc x -> acc ++ convertChar x) ""  
  where 
    convertChar = \case 
      '(' -> "_parensL_"
      ')' -> "_parensR_"
--      '\'' -> "_squote_"
      other -> [other]

but seems like a better fix would be to do "percent-encoding" . I wonder if that would be allright and in which case how to do that. Looks like we could import a library like https://hackage.haskell.org/package/network-uri-2.6.4.2/docs/Network-URI.html#v:escapeURIString . Before putting up a PR, I wanted to ask if it's fine ?

@teto
Copy link
Author

teto commented Jan 2, 2023

#74

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

No branches or pull requests

1 participant