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

[BUG] Swagger model starting with "Map" produces invalid .swagger.dart api #553

Closed
mgj opened this issue Feb 21, 2023 · 1 comment · Fixed by #562
Closed

[BUG] Swagger model starting with "Map" produces invalid .swagger.dart api #553

mgj opened this issue Feb 21, 2023 · 1 comment · Fixed by #562
Assignees
Labels
bug Something isn't working Triage needed

Comments

@mgj
Copy link

mgj commented Feb 21, 2023

Describe the bug
An endpoint which return a schema/model with a name that starts with Map breaks code generation. Renaming the MapXxx-model to MyMapXxx resolves the issue.

The generated swagger_broken.swagger.dart looks like this:

Future<chopper.Response<MapImage>> restMapImageGet({String? xApiVersion}) {
    return _restMapImageGet(xApiVersion: xApiVersion);
  }

To Reproduce
I have created a repository with a minimal example: https://github.com/mgj/flutter_openapi_generator_issue

  • Clone it
  • Run flutter pub get
  • Run flutter packages pub run build_runner build

Observe that the generated swagger_broken.swagger.dart is incorrect while swagger_works.swagger.dart is correct.

Expected behavior
The generated swagger_works.swagger.dart should instead looks like this:

Future<chopper.Response<MyMapImage>> restMapImageGet({String? xApiVersion}) {
    generatedMapping.putIfAbsent(MyMapImage, () => MyMapImage.fromJsonFactory);

    return _restMapImageGet(xApiVersion: xApiVersion);
  }

Swagger specification link
Working: https://github.com/mgj/flutter_openapi_generator_issue/blob/main/generator_issue/lib/rest/openapi/swagger_works.json
Broken: https://github.com/mgj/flutter_openapi_generator_issue/blob/main/generator_issue/lib/rest/openapi/swagger_broken.json

Library version used:
swagger_dart_code_generator: 2.10.1

Additional context
No additional context but please let me know if there is any more information I can provide to help resolve this issue.

@mgj mgj added bug Something isn't working Triage needed labels Feb 21, 2023
@Vovanella95
Copy link
Collaborator

Hi @mgj , thanks for patience. Issue is fixed!. Will be available in 2.10.3 in a day or two!

Vovanella95 added a commit that referenced this issue Mar 1, 2023
Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue Mar 8, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue Mar 22, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue Mar 23, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

* Fixed #572

* Fixed #570

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue Apr 11, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

* Fixed #572

* Fixed #570

* Fix #576

* Updated changelog

* Some fixed in configs

* Reverted changes

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue Apr 12, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

* Fixed #572

* Fixed #570

* Fix #576

* Updated changelog

* Some fixed in configs

* Reverted changes

* implemented support of multipart for border cases

* Added fix for partFile parameters

* Updated pubspec and changelog

* Formatted lib folder

* Fixed warning

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue Apr 20, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

* Fixed #572

* Fixed #570

* Fix #576

* Updated changelog

* Some fixed in configs

* Reverted changes

* implemented support of multipart for border cases

* Added fix for partFile parameters

* Updated pubspec and changelog

* Formatted lib folder

* Fixed warning

* Updated libs
Fixed generation of with base url

* Small fix

* Fixed dependencies

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue May 1, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

* Fixed #572

* Fixed #570

* Fix #576

* Updated changelog

* Some fixed in configs

* Reverted changes

* implemented support of multipart for border cases

* Added fix for partFile parameters

* Updated pubspec and changelog

* Formatted lib folder

* Fixed warning

* Updated libs
Fixed generation of with base url

* Small fix

* Fixed dependencies

* Added support of nullabe responses

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue May 2, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

* Fixed #572

* Fixed #570

* Fix #576

* Updated changelog

* Some fixed in configs

* Reverted changes

* implemented support of multipart for border cases

* Added fix for partFile parameters

* Updated pubspec and changelog

* Formatted lib folder

* Fixed warning

* Updated libs
Fixed generation of with base url

* Small fix

* Fixed dependencies

* Added support of nullabe responses

* Fixed #579

* Removed not needed tests

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Vovanella95 added a commit that referenced this issue Jun 7, 2023
* Fixed #553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed #554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed #571

* Fixed #572

* Fixed #570

* Fix #576

* Updated changelog

* Some fixed in configs

* Reverted changes

* implemented support of multipart for border cases

* Added fix for partFile parameters

* Updated pubspec and changelog

* Formatted lib folder

* Fixed warning

* Updated libs
Fixed generation of with base url

* Small fix

* Fixed dependencies

* CUSTOM_IMPORT_AND_RETURN_TYPE : DONE

* Added support of nullabe responses

* Fixed #579

* Removed not needed tests

* Fixed generation of request parameters

* Some refactoring of generator

* Some improvements and refactoring

* Some fixes and refactoring

* Updated version in pubspec

* Changed string postfix extension

* Updated changelog

* Fixed warnings

* Fixed generation of classes from list properties of another classes

* Fixed generation of number classes

* Updated pubspec

* Some fixes and refactoring

* Some fixes and improvements

* Some fixes

* Fixed models generation

* Updated pubspec and changelog

* Fixed generation of complex models

* Updated pubspec and changelog

* Fixed generation of allOf refs

* Updated pubspec and changelog

* Resolved conflicts

* Some fixes

* Some fixes and refactoring

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Co-authored-by: Yauheni_Navakolski <>
vipw pushed a commit to vipw/swagger-dart-code-generator that referenced this issue Aug 9, 2023
* Fixed epam-cross-platform-lab#553 Generation putIfAbsent for names begins with "Map"

* Removed not needed property

* Removed toJson generation

* Returned generation of toJson()

* Implemented toJson only for some models feature

* Fixed some errors

* Added some fixes

* Added createToJson: false for models without toJson

* Fixed epam-cross-platform-lab#554 generation of putIfAbsent for not needed schemas

* Updated pubspec and changelog

* Reverted change in analysis_options

* Fixed warnings

* Fixed generation of multipart data

* Fixed parameter type generation

* Changed dynamic to Object

* Some fixes

* Add recognition of int64 as int

* Fixed epam-cross-platform-lab#571

* Fixed epam-cross-platform-lab#572

* Fixed epam-cross-platform-lab#570

* Fix epam-cross-platform-lab#576

* Updated changelog

* Some fixed in configs

* Reverted changes

* implemented support of multipart for border cases

* Added fix for partFile parameters

* Updated pubspec and changelog

* Formatted lib folder

* Fixed warning

* Updated libs
Fixed generation of with base url

* Small fix

* Fixed dependencies

* CUSTOM_IMPORT_AND_RETURN_TYPE : DONE

* Added support of nullabe responses

* Fixed epam-cross-platform-lab#579

* Removed not needed tests

* Fixed generation of request parameters

* Some refactoring of generator

* Some improvements and refactoring

* Some fixes and refactoring

* Updated version in pubspec

* Changed string postfix extension

* Updated changelog

* Fixed warnings

* Fixed generation of classes from list properties of another classes

* Fixed generation of number classes

* Updated pubspec

* Some fixes and refactoring

* Some fixes and improvements

* Some fixes

* Fixed models generation

* Updated pubspec and changelog

* Fixed generation of complex models

* Updated pubspec and changelog

* Fixed generation of allOf refs

* Updated pubspec and changelog

* Resolved conflicts

* Some fixes

* Some fixes and refactoring

---------

Co-authored-by: Uladzimir Paliukhovich <uladzimir_paliukhovich@epam.com>
Co-authored-by: Yauheni_Navakolski <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Triage needed
Projects
None yet
3 participants