Skip to content

Fix indentation #847

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

Merged
merged 51 commits into from
Jun 9, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1e27364
Issue #642 - Removing the unnecesary \n added to generated example re…
Apr 16, 2015
1d175c1
+ advices for OS X Users
denyago Apr 18, 2015
5fbd0af
Added support for Basic Auth
Apr 30, 2015
abe072c
Merge pull request #703 from MaorBril/master
fehguy Apr 30, 2015
cd2e030
Linked to the 2.0.18 tag instead of the no longer existing 2.0.17.
eerwitt Apr 30, 2015
e3f09ae
Merge pull request #708 from eerwitt/update_documentation_links
webron Apr 30, 2015
9876e79
Found the 2.0.17 tag under 2.0.17 instead of v2.0.17.
eerwitt Apr 30, 2015
b70f5bc
Merge pull request #709 from eerwitt/update_documentation_links
webron Apr 30, 2015
df95114
Fixes a bug with Node.js example generating invalid package.json and …
May 4, 2015
df2cbfd
Merge pull request #720 from akras14/master
fehguy May 4, 2015
bae40de
Update README.md
lindybrandon May 7, 2015
9e382ec
Fix a typo in the README
sebest May 17, 2015
0c94b89
Merge pull request #750 from sebest/patch-1
webron May 17, 2015
8dbb1aa
Merge pull request #654 from kvelakur/master
fehguy May 21, 2015
e592d1b
Merge pull request #660 from denyago/master
fehguy May 21, 2015
89e3bcc
Adds isPrimitiveType flag to CodegenParameter.
chakrit May 21, 2015
e3c1163
Merge pull request #773 from hyperworks/master
fehguy May 23, 2015
26a22a3
Create LICENSE
webron May 29, 2015
ca46405
Update README.md
webron May 29, 2015
f025dda
merged
fehguy Jun 8, 2015
915ad77
Merge branch 'develop_2.0'
fehguy Jun 8, 2015
0dd8670
rollback python template
wing328 Jun 9, 2015
d5cbbae
rollback ruby swagger template
wing328 Jun 9, 2015
5f6622c
rollback ruby template
wing328 Jun 9, 2015
2e12ac5
rollback perl template
wing328 Jun 9, 2015
50ae965
rollback php template
wing328 Jun 9, 2015
263b408
rollback python3 template
wing328 Jun 9, 2015
6253bbf
roll back qt5cpp template
wing328 Jun 9, 2015
eee8685
rollback flash template
wing328 Jun 9, 2015
eede02a
rollback nodejs and htmldocs template
wing328 Jun 9, 2015
b1f5c03
rollback objc templates
wing328 Jun 9, 2015
7d6fdf9
rollback retroit template
wing328 Jun 9, 2015
b636d2a
rollback scala template
wing328 Jun 9, 2015
f2ee63d
rollback scalatra template
wing328 Jun 9, 2015
d8060f4
rollback swagger-static template
wing328 Jun 9, 2015
410144e
rollback swift template
wing328 Jun 9, 2015
6617af5
rollback tizen template
wing328 Jun 9, 2015
6efef51
rollback validator template
wing328 Jun 9, 2015
a8f6044
rollback akka-scala template
wing328 Jun 9, 2015
ab9daaa
rollback android template
wing328 Jun 9, 2015
f610958
rollback asyncscala template
wing328 Jun 9, 2015
7b6480f
rollback codegen template
wing328 Jun 9, 2015
46c5b77
rollback csharp template
wing328 Jun 9, 2015
900f396
rollback grovvy template
wing328 Jun 9, 2015
180d48e
rollback java template
wing328 Jun 9, 2015
29c41ad
rollback java jxrs template
wing328 Jun 9, 2015
fc38b9b
rollback akkascala to another commit (637ee77d66dbcd2a94a22941754158d…
wing328 Jun 9, 2015
d155ddd
rollback java spring mvc template
wing328 Jun 9, 2015
7fd996b
update php sample
wing328 Jun 9, 2015
a593271
rollback flash apiinvoker based on 8ee8eddcff26d72a89538bcdac39f2f730…
wing328 Jun 9, 2015
680078d
fix csharp refer to apiinvoker
wing328 Jun 9, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds isPrimitiveType flag to CodegenParameter.
This is required in some languages like Obj-C where there is no automatic value boxing and
handling of primitive types require extra work compared to non-primitive types.

Case in point: BOOL type. To assign BOOL into a dictionary, one needs to box it into an
(NSValue *) instance, so to build a dictionary for sending form data, for example, you
cannot do this in the template:

    dict["{{paramName}}"] = {{paramName}};

Because if the parameter ends up being of type BOOL, an error about boxing values will be
generated:

    BOOL boolValue = NO;
    dict["boolValue"] = boolValue;
                        ^---------------- Cannot do the assignment here.

The fix is to wrap it in @() like so:

    BOOL boolValue = NO;
    dict["boolValue"] = @(boolValue);

So a flag is needed in CodegenParameter so we can selectively emit the right boxing or
non-boxing assignment in the templates.
  • Loading branch information
chakrit committed May 21, 2015
commit 89e3bcc4bb0817cbffca45ce8d6b31cafaca4ac6
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

public class CodegenParameter {
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer, secondaryParam;
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer, secondaryParam,
isPrimitiveType, notPrimitiveType;
public String baseName, paramName, dataType, collectionFormat, description, baseType;
public String jsonSchema;

Expand Down Expand Up @@ -34,6 +35,8 @@ public CodegenParameter copy() {
output.isBodyParam = this.isBodyParam;
output.required = this.required;
output.jsonSchema = this.jsonSchema;
output.isPrimitiveType = this.isPrimitiveType;
output.notPrimitiveType = this.notPrimitiveType;

return output;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
CodegenProperty model = fromProperty(qp.getName(), property);
p.collectionFormat = collectionFormat;
p.dataType = model.datatype;
p.isPrimitiveType = languageSpecificPrimitives.contains(p.dataType);
p.notPrimitiveType = !p.isPrimitiveType;
p.paramName = toParamName(qp.getName());

if(model.complexType != null) {
Expand Down