Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schemas doesn't inherits json_serializer #233

Open
beerline opened this issue May 23, 2024 · 2 comments
Open

Schemas doesn't inherits json_serializer #233

beerline opened this issue May 23, 2024 · 2 comments

Comments

@beerline
Copy link

Steps to reproduce

  1. define json_serializer: freezed in swagger_parser
  2. define two schemas without json_serializer
  3. run dart run swagger_parser

Expected results

for both schemas should be generated freezed files

Actual results

for both schemas generated json_serializable

Your OpenApi snippet

swagger_parser:
  output_directory: lib/core/api
  language: dart

  json_serializer: freezed

  required_by_default: true
  root_client: true
  export_file: true
  put_in_folder: true
  put_clients_in_folder: true
  path_method_name: true
  enums_to_json: true
  enums_parent_prefix: false
  unknown_enum_value: false
  mark_files_as_generated: true
  original_http_response: false

  schemes:
    - schema_path: api_schemas/fapi.json
      root_client_name: FApiClient
      output_directory: lib/core/api/fapi
      client_postfix: FApi

    - schema_path: api_schemas/credits_api.json
      root_client_name: CreditsClient
      name: CreditsApi
      output_directory: lib/core/api/credits_api
      client_postfix: Credits

Code sample

No response

Logs

Logs
[Paste your logs here]

Dart version and used packages versions

Dart version
Dart SDK version: 3.3.4 (stable) (Tue Apr 16 19:56:12 2024 +0000) on "macos_x64"
Packages version
swagger_parser: ^1.17.3
@StarProxima
Copy link
Collaborator

Does this manifest only for json_serializer or for other parameters too?

@beerline
Copy link
Author

@StarProxima i can confirm same error for unknown_enum_value parameter.

I looked through source files and i found that at swagger_parser-1.17.3/lib/src/config/swp_config.dart:279 getting default config overrides only outputDirectory. So if no parameter was defined under schema it would take default value, which is for json_serializer is JsonSerializer.jsonSerializable.

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

No branches or pull requests

2 participants