Skip to content

Refactor generated model files and enhance string handling - #65

Open
TimvdVooren wants to merge 7 commits into
masreplay:mainfrom
Harborn-digital:main
Open

Refactor generated model files and enhance string handling#65
TimvdVooren wants to merge 7 commits into
masreplay:mainfrom
Harborn-digital:main

Conversation

@TimvdVooren

Copy link
Copy Markdown
  • Removed unused generated files for validation parameters and version model.
  • Updated library declarations for validation conditional query parameters and version model.
  • Improved string escaping logic in stringCode and encodeWithRawKeys functions to handle special characters and newlines correctly.
  • Added tests to verify string escaping functionality and ensure proper handling of raw strings.

- Removed unused generated files for validation parameters and version model.
- Updated library declarations for validation conditional query parameters and version model.
- Improved string escaping logic in `stringCode` and `encodeWithRawKeys` functions to handle special characters and newlines correctly.
- Added tests to verify string escaping functionality and ensure proper handling of raw strings.
@masreplay

Copy link
Copy Markdown
Owner

AI?

@TimvdVooren

Copy link
Copy Markdown
Author

@masreplay

Personally, I am not an AI sir 😄

But I did use AI for this fix, which might be why it raised your concern.
I was encountering a problem in your package which made it so it was not handling string escaping characters correctly anymore.

@TimvdVooren

Copy link
Copy Markdown
Author

See my issue, for more info:
#64

harmjanr and others added 6 commits June 5, 2026 15:20
The union ...MapJsonConverter.toJson wrapped the payload as
{value: ..., runtimeType: ...}, which doesn't match the backend's
discriminated shape, so serialized union request bodies were rejected.
Emit the flat inner object instead (symmetric to the fromJson fix in #1),
returning {} for the null fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…alization

Fix union toJson to emit flat inner object
An inline oneOf/anyOf nested in an array response had no title of its own, so
its union class was named after its discriminator keys
(e.g. basic/video/timed -> BasicOrvideoOrtimedUnion). Two endpoints whose
responses share discriminator values then collapse onto the same union class,
binding it to the wrong variant types. Concretely, GET /quiz and GET /questions
both use basic/video/timed, so getQuizzes was typed with the question union and
crashed deserializing quiz payloads.

Propagate the array's title onto an untitled oneOf/anyOf items schema, so the
nested union inherits the array's (operation-level) title and gets a unique,
per-operation name (e.g. "Response Get Quizzes" -> ResponseGetQuizzes), the same
way a non-array oneOf response is already named from its own title.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fix colliding union names for inline oneOf/anyOf inside arrays
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.

3 participants