Skip to content

Commit

Permalink
chore: use primitive int for integer types (#68)
Browse files Browse the repository at this point in the history
* chore: use primitive int for integer types
  • Loading branch information
shwetha-manvinkurke authored Jun 23, 2021
1 parent 07f8ef4 commit 32f7d36
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/go/test/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestDateTimeQueryParams(t *testing.T) {
dateCreatedAfter := time.Now().Add(2)
dateTest := "2021-03-31"

pageSize := int32(4)
pageSize := 4

params := openapi.ListCallRecordingParams{
DateCreated: &dateCreated,
Expand Down
2 changes: 1 addition & 1 deletion examples/go/test/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestQueryParams(t *testing.T) {
dateCreatedBefore := time.Date(2000, 1, 2, 1, 0, 0, 0, time.UTC)
dateCreatedAfter := time.Date(2000, 1, 4, 1, 0, 0, 0, time.UTC)
dateTest := "2021-03-31"
pageSize := int32(4)
pageSize := 4
params := openapi.ListCallRecordingParams{
DateCreated: &dateCreated,
DateCreatedBefore: &dateCreatedBefore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protected AbstractTwilioGoGenerator() {
super();

embeddedTemplateDir = templateDir = getName();
typeMapping.put("integer", "int");
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/twilio/oai/TwilioTerraformGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public Map<String, Object> postProcessOperationsWithModels(final Map<String, Obj
createOperation.vendorExtensions.put("x-resource-id", idParameter.paramName);
createOperation.vendorExtensions.put("x-resource-id-in-snake-case", idParameterSnakeCase);

if ("int32".equals(idParameter.dataType)) {
createOperation.vendorExtensions.put("x-resource-id-conversion-func", "Int32ToString");
if ("int".equals(idParameter.dataType)) {
createOperation.vendorExtensions.put("x-resource-id-conversion-func", "IntToString");
}
});
}
Expand Down Expand Up @@ -229,7 +229,7 @@ private String buildSchemaType(final String dataType, final String schemaType, f
switch (dataType) {
case "float32":
return String.format("AsFloat(%s)", schemaType);
case "int32":
case "int":
return String.format("AsInt(%s)", schemaType);
case "bool":
return String.format("AsBool(%s)", schemaType);
Expand Down

0 comments on commit 32f7d36

Please sign in to comment.