-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
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 ?
Metadata
Metadata
Assignees
Labels
No labels