Special Character Normalization #1284
Replies: 2 comments 1 reply
-
I have a similar API I have to work with: https://test.ngu.no/api/nadag/innmelding/openapi/v1 It is full of class properties that contain non-ascii unicode characters. Example (removed lots of stuff) of the OpenAPI file: ---
openapi: 3.1.0
components:
schemas:
GeotekniskUnders:
type: object
properties:
område:
$ref: "#/components/schemas/Polygon"
type: object
undersøkelsePeriodeFra:
type: string
format: date-time
examples:
- 2022-03-10T12:15:50-04:00
sammensattområde:
$ref: "#/components/schemas/MultiPolygon"
type: object
undersøkelsePeriodeTil:
type: string
format: date-time
examples:
- 2022-03-10T12:15:50-04:00
undersøkelseÅrAntatt:
type: integer
format: int32
So in this example, I get a class definition like this: class GeotekniskUnders:
område: Union[Unset, "Polygon"] = UNSET
unders_ø_kelse_periode_fra: Union[Unset, datetime.datetime] = UNSET
sammensattområde: Union[Unset, "MultiPolygon"] = UNSET
unders_ø_kelse_periode_til: Union[Unset, datetime.datetime] = UNSET
unders_ø_kelse_å_r_antatt: Union[Unset, int] = UNSET I am wondering why some characters ( Just to be clear. I wish I had a class like this: class GeotekniskUnders:
område: Union[Unset, "Polygon"] = UNSET
undersøkelse_periode_fra: Union[Unset, datetime.datetime] = UNSET
sammensattområde: Union[Unset, "MultiPolygon"] = UNSET
undersøkelse_periode_til: Union[Unset, datetime.datetime] = UNSET
undersøkelse_år_antatt: Union[Unset, int] = UNSET Sorry if I hijack your discussion @MatteoGisondi, but this seems related to me. |
Beta Was this translation helpful? Give feedback.
-
I tested your patch. I get a new result without the extra underscores ( class GeotekniskUnders:
omrade: Union[Unset, "Polygon"] = UNSET
undersokelse_periode_fra: Union[Unset, datetime.datetime] = UNSET
sammensattomrade: Union[Unset, "MultiPolygon"] = UNSET
undersokelse_periode_til: Union[Unset, datetime.datetime] = UNSET
undersokelse_ar_antatt: Union[Unset, int] = UNSET But I would like to keep the Unicode characters and not normalise them to their base character. Could your normalisation be a configuration option? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Endpoints containing special characters are parsed such that they are treated as words when split.
OpenAPI Spec File
The problem can be seen in this (admittedly poorly written) API spec: https://geofeux.sopfeu.qc.ca/sopfeu-api/swagger/v1/swagger.json
Additional context
Currently generated client:
Desired:
Notably for example,
utilisateurs_r_é_serv_é_à_lusage_de_la_compagnie_lg2
should beutilisateurs_reserve_a_lusage_de_la_compagnie_lg2
, as it's quite illegible otherwise.Beta Was this translation helpful? Give feedback.
All reactions