Skip to content

Conversation

@t-unit
Copy link
Owner

@t-unit t-unit commented Jan 15, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for OpenAPI 3.1's contentEncoding and contentMediaType fields, enabling fine-grained control over how content-encoded string schemas map to Dart types.

Changes:

  • Introduces a new contentMediaTypes configuration mapping that allows users to specify whether schemas with contentEncoding should generate List<int> (binary) or String (text) properties
  • Adds the contentSchema field to the Schema model (part of OpenAPI 3.1 spec, currently unused but prepared for future implementation)
  • Changes default behavior: schemas with contentEncoding now default to List<int> (binary) instead of String, with fallback configurable via the new config option

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/tonik_core/lib/src/config/schema_content_type.dart New enum defining binary/text types for schema content
packages/tonik_core/lib/src/config/tonik_config.dart Adds contentMediaTypes field with equality/hashCode support
packages/tonik_core/lib/tonik_core.dart Exports new SchemaContentType enum
packages/tonik_core/test/config/tonik_config_test.dart Tests for contentMediaTypes configuration storage and equality
packages/tonik_parse/lib/src/model/schema.dart Adds contentSchema field to Schema model
packages/tonik_parse/lib/src/model/schema.g.dart Generated code for contentSchema deserialization
packages/tonik_parse/lib/src/model_importer.dart Implements logic to resolve content-encoded models based on config
packages/tonik_parse/lib/src/importer.dart Threads contentMediaTypes config to ModelImporter
packages/tonik_parse/test/model/model_binary_test.dart Comprehensive tests for contentEncoding handling with and without config
packages/tonik_parse/test/model/single_schema_import_test.dart Updates Schema instantiations to include contentSchema field
packages/tonik/lib/src/config/tonik_config.dart Adds contentMediaTypes to CLI config with proper equality/hashCode
packages/tonik/lib/src/config/config_loader.dart Implements YAML parsing for contentMediaTypes configuration
packages/tonik/test/src/config/config_loader_test.dart Tests for loading and validating contentMediaTypes from YAML
packages/tonik/bin/tonik.dart Passes contentMediaTypes from config to Importer
scripts/setup_integration_tests.sh Adds --config flag for binary_models integration test
integration_test/binary_models/tonik.yaml Configuration file mapping media types for integration tests
integration_test/binary_models/openapi.yaml Adds comprehensive test schemas with various contentMediaType combinations
integration_test/binary_models/binary_models_test/test/content_media_type_test.dart End-to-end tests validating generated code behavior
integration_test/binary_models/binary_models_test/imposter/response.groovy Mock server responses for contentMediaType test endpoints
docs/data_types.md Documents content-encoded strings and configuration usage
docs/configuration.md Adds contentMediaTypes configuration section with examples
docs/roadmap.md Removes contentEncoding/contentMediaType from roadmap (now implemented)
.vscode/settings.json Adds "Millis" and "unconfigured" to spell check dictionary

Copy link
Contributor

Copilot AI commented Jan 15, 2026

@t-unit I've opened a new pull request, #70, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 15, 2026 19:53
Co-authored-by: t-unit <366172+t-unit@users.noreply.github.com>
Clarify test comment about contentEncoding and bidirectional conversion
@t-unit t-unit merged commit 002c78c into main Jan 15, 2026
3 checks passed
@t-unit t-unit deleted the contentEncoding branch January 15, 2026 20:05
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.

2 participants