Skip to content

Commit

Permalink
Merge branch 'main' into fix_content_type_java
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 authored Sep 3, 2024
2 parents 315ed73 + d123b38 commit 3e8785f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

package com.twilio.rest.previewiam.organizations;
package com.twilio.rest.previewiam.v1;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Do not edit the class manually.
*/

package com.twilio.rest.previewiam.organizations;
package com.twilio.rest.previewiam.v1;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.constant.EnumConstants;
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_twilio_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def build(openapi_spec_path: str, output_path: str, language: str) -> None:
else:
spec_folder = openapi_spec_path
spec_files = sorted(os.listdir(spec_folder))

spec_files.remove('twilio_content_v1.json')
generate(spec_folder, spec_files, output_path, language)


Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/twilio/oai/TwilioCodegenAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.oai.common.ApplicationConstants;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.servers.Server;
Expand Down Expand Up @@ -146,6 +143,9 @@ private String getInputSpecDomain() {
}

private String getInputSpecVersion() {
return codegen.getInputSpec().replaceAll(INPUT_SPEC_PATTERN, "${version}");
String version = codegen.getInputSpec().replaceAll(INPUT_SPEC_PATTERN, "${version}");
boolean textExists = Arrays.stream(ApplicationConstants.VERSION_LESS_SPECS)
.anyMatch(ignoredVersion -> ignoredVersion.equals(version));
return textExists ? "" : version;
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/twilio/oai/common/ApplicationConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ public class ApplicationConstants {
public static final String PHONE_NUMBER = "phone-number";

public static final Predicate<Integer> SUCCESS = i -> i != null && i >= 200 && i < 400;

public static final String[] VERSION_LESS_SPECS = {"organizations"};

}
9 changes: 8 additions & 1 deletion src/test/java/com/twilio/oai/TwilioGeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
public class TwilioGeneratorTest {
@Parameterized.Parameters
public static Collection<Generator> generators() {
return Arrays.asList(Generator.TWILIO_PYTHON);
return Arrays.asList(Generator.TWILIO_CSHARP,
Generator.TWILIO_GO,
Generator.TWILIO_JAVA,
Generator.TWILIO_NODE,
Generator.TWILIO_PHP,
Generator.TWILIO_PYTHON,
Generator.TWILIO_RUBY,
Generator.TWILIO_TERRAFORM);
}

private final Generator generator;
Expand Down

0 comments on commit 3e8785f

Please sign in to comment.