feat(core): support non-JSON response content types#81
Open
halotukozak wants to merge 3 commits into
Open
Conversation
Response parsing previously only looked at application/json, silently dropping schemas for other content types. Now the parser picks the first matching response content type (JSON keeps priority) and records it on the Response model. text/plain maps to String, application/octet-stream to ByteArray — including when the content carries no explicit schema. Ktor's body<T>() deserializes both natively, so no generator changes beyond the resolved return type are needed. Request bodies stay limited to the existing JSON/form/multipart types via ContentType.REQUEST_TYPES. Closes #36 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Coverage Report
|
…sponses # Conflicts: # core/src/main/kotlin/com/avsystem/justworks/core/parser/SpecParser.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Response parsing previously only looked at
application/json, silently dropping schemas fortext/plain,application/octet-stream, etc.Responsemodel (contentType: ContentType?).text/plain→String,application/octet-stream→ByteArray, including when the content has no explicit schema.body<T>()deserializesString/ByteArraynatively, so no generator change beyond the resolved return type is needed.ContentType.REQUEST_TYPESsubset — request behavior unchanged.Tests
text/plain→STRING,application/octet-stream(no schema) →BYTE_ARRAY,contentTyperecorded.String, octet-stream returnsByteArray.ContentTypeTest: full enum order +REQUEST_TYPESpriority subset.Closes #36
🤖 Generated with Claude Code