Skip to content

feat(core): support non-JSON response content types#81

Merged
mfabisiak merged 5 commits into
masterfrom
feat/36-non-json-responses
Jul 24, 2026
Merged

feat(core): support non-JSON response content types#81
mfabisiak merged 5 commits into
masterfrom
feat/36-non-json-responses

Conversation

@halotukozak

Copy link
Copy Markdown
Contributor

What

Response parsing previously only looked at application/json, silently dropping schemas for text/plain, application/octet-stream, etc.

  • Parser now picks the first matching response content type (JSON keeps priority via declaration order) and records it on the Response model (contentType: ContentType?).
  • text/plainString, application/octet-streamByteArray, including when the content has no explicit schema.
  • Ktor's body<T>() deserializes String/ByteArray natively, so no generator change beyond the resolved return type is needed.
  • Request bodies stay limited to JSON/form/multipart via the new ContentType.REQUEST_TYPES subset — request behavior unchanged.

Tests

  • Parser: text/plainSTRING, application/octet-stream (no schema) → BYTE_ARRAY, contentType recorded.
  • Generator: text response returns String, octet-stream returns ByteArray.
  • ContentTypeTest: full enum order + REQUEST_TYPES priority subset.

Closes #36

🤖 Generated with Claude Code

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>
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Coverage Report

Overall Project 96.85% -0.16% 🍏
Files changed 92.97% 🍏

File Coverage
ApiSpec.kt 100% 🍏
ParametersGenerator.kt 96.3% -3.7%
BodyGenerator.kt 95.49% -0.85%
SpecParser.kt 94.73% -0.28% 🍏

@halotukozak halotukozak added this to the 1.0.0 milestone Jun 9, 2026
@halotukozak halotukozak self-assigned this Jun 9, 2026
@halotukozak halotukozak added the enhancement New feature or request label Jun 9, 2026
…sponses

# Conflicts:
#	core/src/main/kotlin/com/avsystem/justworks/core/parser/SpecParser.kt
@mfabisiak
mfabisiak self-requested a review July 21, 2026 18:31
Comment thread core/src/main/kotlin/com/avsystem/justworks/core/parser/SpecParser.kt Outdated
Copilot AI review requested due to automatic review settings July 24, 2026 12:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 24, 2026 12:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mfabisiak
mfabisiak merged commit 2f1d6a2 into master Jul 24, 2026
2 checks passed
@mfabisiak
mfabisiak deleted the feat/36-non-json-responses branch July 24, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support non-JSON response content types (text/plain, application/octet-stream, etc.)

3 participants