swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Support for modelPropertyNaming, other then camelCase, in the Dart language

Open manuelgomes2 opened this issue 7 years ago • 6 comments

… Dart language options.

PR checklist

  • [x] Read the contribution guidelines.
  • [x] Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • [x] Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • [x] Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

(details of the change, additional tests that have been done, reference to the issue for tracking, etc)

manuelgomes2 avatar May 19 '18 17:05 manuelgomes2

Hi, just wondering if there are any updates for this PR and if it will be merged into master? I was about to submit a similar PR to solve this issue for the dart code generator too! Ling

lingster avatar Jul 02 '19 15:07 lingster

image

someone, please help to resolve this conflict

yk-theapps avatar Jul 20 '19 15:07 yk-theapps

@yukayeung on it

HugoMario avatar Jul 20 '19 18:07 HugoMario

hello guys, i just resolved conflict but PR is failing on this assertion: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/java/io/swagger/codegen/dart/DartModelEnumTest.java#L83

java.lang.AssertionError: expected [Sample] but found [sample]
	at io.swagger.codegen.dart.DartModelEnumTest.overrideEnumTest(DartModelEnumTest.java:83)

@lingster @yukayeung , i'm not familiar with dart, so can you please let me know if the test is ok failing here or should be changed?

HugoMario avatar Jul 20 '19 19:07 HugoMario

I'm quite a beginner on Dart too. but In Dart, the class naming convention is followed UpperCamelCase too. if code gent DartModelEnum test is case sensitive. it should be changed.
Let seek advice from @lingster since he did helping to do similar PR for this.

yk-theapps avatar Jul 22 '19 09:07 yk-theapps

@HugoMario This PR allows users to change the naming of the modelProperty. It's been defaulted to camelCase as per line: 38 here: https://github.com/swagger-api/swagger-codegen/pull/8213/commits/e08e0ebe64d06d3242d8f8a9267bbb96d41a2cb0

I think the tests might pass if you amend this to be: protected String modelPropertyNaming = CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.PascalCase.name();

lingster avatar Jul 23 '19 08:07 lingster