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

chore: ignore content_v1 spec for release and iam_organizations spec file as versionless #606

Merged
merged 6 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading