diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 30cdca1..3965ff6 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 47e8e950-a454-4ebb-9f78-86fda7dfa0c2 management: - docChecksum: a34bd1c885aa42eb3175940494581f67 + docChecksum: 899b27d9399190d5ff40fc3e7c07c252 docVersion: 0.2.0 - speakeasyVersion: 1.360.0 - generationVersion: 2.392.0 - releaseVersion: 1.6.0 - configChecksum: 04057022610c9a5aee37164daac7ba9d + speakeasyVersion: 1.366.0 + generationVersion: 2.396.0 + releaseVersion: 1.6.1 + configChecksum: 7ea5b4b09a13f982a471430aa1962264 repoURL: https://github.com/StyraInc/opa-java.git published: true features: @@ -20,7 +20,7 @@ features: globalSecurityCallbacks: 0.1.0 globalServerURLs: 2.82.1 sdkHooks: 0.1.0 - unions: 0.0.4 + unions: 0.0.5 generatedFiles: - src/main/java/com/styra/opa/openapi/SecuritySource.java - src/main/java/com/styra/opa/openapi/SDKConfiguration.java diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 55d6043..212db6d 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false java: - version: 1.6.0 + version: 1.6.1 additionalDependencies: - testImplementation:org.junit.jupiter:junit-jupiter-api:5.8.2 - runtimeOnly:org.junit.jupiter:junit-jupiter-engine:5.8.2 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 9408fef..865d244 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,18 +1,19 @@ -speakeasyVersion: 1.360.0 +speakeasyVersion: 1.366.0 sources: openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:81c3a5edacaf5a325d464a84f952cb2e2647ffdc1d354b7a1077772cd0f5ce1a - sourceBlobDigest: sha256:443ed43ddde1813b773d4c9ef167a4be2fb41e568b801e43790c5b41bf80386b + sourceRevisionDigest: sha256:b9746b463e589cca3c5cc6ed302324653a97997700cb9792428fce62484b8113 + sourceBlobDigest: sha256:44d2deaabd45963b025bb2155930a9485db51b724dce007a2f1a08c8a5c985a0 tags: - latest + - main targets: opa: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:81c3a5edacaf5a325d464a84f952cb2e2647ffdc1d354b7a1077772cd0f5ce1a - sourceBlobDigest: sha256:443ed43ddde1813b773d4c9ef167a4be2fb41e568b801e43790c5b41bf80386b - outLocation: /Users/cad/f/src/opa-java + sourceRevisionDigest: sha256:b9746b463e589cca3c5cc6ed302324653a97997700cb9792428fce62484b8113 + sourceBlobDigest: sha256:44d2deaabd45963b025bb2155930a9485db51b724dce007a2f1a08c8a5c985a0 + outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index b2399ea..827e655 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -338,3 +338,14 @@ Based on: - [java v1.6.0] . ### Releases - [Maven Central v1.6.0] https://central.sonatype.com/artifact/com.styra.opa/openapi/1.6.0 - . + + +## 2024-08-14 00:21:19 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.366.0 (2.396.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v1.6.1] . +### Releases +- [Maven Central v1.6.1] https://central.sonatype.com/artifact/com.styra.opa/openapi/1.6.1 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 45d1a57..9d30771 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,6 @@ plugins { id 'signing' id("java") id("checkstyle") - id "nebula.lint" version "17.8.0" } compileJava.options.encoding = "UTF-8" @@ -43,7 +42,7 @@ model { jar { dependsOn(":generatePomFileForMavenPublication") - into("META-INF/maven/com.styra/opa") { + into("META-INF/maven/com.styra.opa/openapi") { from("$buildDir/pom.xml") } } @@ -76,9 +75,9 @@ publishing { publications { maven(MavenPublication) { - groupId = 'com.styra' - artifactId = 'opa' - version = '1.6.0' + groupId = 'com.styra.opa' + artifactId = 'openapi' + version = '1.6.1' from components.java diff --git a/docs/sdks/opaapiclient/README.md b/docs/sdks/opaapiclient/README.md index 0b7acb6..69c6115 100644 --- a/docs/sdks/opaapiclient/README.md +++ b/docs/sdks/opaapiclient/README.md @@ -67,6 +67,8 @@ public class Application { } ``` + + ### Parameters | Parameter | Type | Required | Description | @@ -142,6 +144,8 @@ public class Application { } ``` + + ### Parameters | Parameter | Type | Required | Description | @@ -220,6 +224,8 @@ public class Application { } ``` + + ### Parameters | Parameter | Type | Required | Description | @@ -300,6 +306,8 @@ public class Application { } ``` + + ### Parameters | Parameter | Type | Required | Description | @@ -369,6 +377,8 @@ public class Application { } ``` + + ### Parameters | Parameter | Type | Required | Description | diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..6689b85 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle index abf456c..12ff7d3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,4 +7,4 @@ * in the user manual at https://docs.gradle.org/7.5.1/userguide/multi_project_builds.html */ -rootProject.name = 'opa' +rootProject.name = 'openapi' diff --git a/src/main/java/com/styra/opa/openapi/SDKConfiguration.java b/src/main/java/com/styra/opa/openapi/SDKConfiguration.java index 28cf02e..072ba5a 100644 --- a/src/main/java/com/styra/opa/openapi/SDKConfiguration.java +++ b/src/main/java/com/styra/opa/openapi/SDKConfiguration.java @@ -23,9 +23,9 @@ public Optional securitySource() { public int serverIdx = 0; public String language = "java"; public String openapiDocVersion = "0.2.0"; - public String sdkVersion = "1.6.0"; - public String genVersion = "2.392.0"; - public String userAgent = "speakeasy-sdk/java 1.6.0 2.392.0 0.2.0 com.styra.opa.openapi"; + public String sdkVersion = "1.6.1"; + public String genVersion = "2.396.0"; + public String userAgent = "speakeasy-sdk/java 1.6.1 2.396.0 0.2.0 com.styra.opa.openapi"; private Hooks _hooks = createHooks(); diff --git a/src/main/java/com/styra/opa/openapi/models/shared/Responses.java b/src/main/java/com/styra/opa/openapi/models/shared/Responses.java index e7b3bf4..1b3048e 100644 --- a/src/main/java/com/styra/opa/openapi/models/shared/Responses.java +++ b/src/main/java/com/styra/opa/openapi/models/shared/Responses.java @@ -5,93 +5,20 @@ package com.styra.opa.openapi.models.shared; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.styra.opa.openapi.utils.OneOfDeserializer; -import com.styra.opa.openapi.utils.TypedObject; -import com.styra.opa.openapi.utils.Utils.JsonShape; -import com.styra.opa.openapi.utils.Utils.TypeReferenceWithShape; -import com.styra.opa.openapi.utils.Utils; -import java.lang.Override; +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo.As; +import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import java.lang.String; -import java.lang.SuppressWarnings; -import java.util.Objects; -@JsonDeserialize(using = Responses._Deserializer.class) -public class Responses { +@JsonTypeInfo(use = Id.NAME, property = "http_status_code", include = As.EXISTING_PROPERTY, visible = true) +@JsonSubTypes({ + @Type(value = ResponsesSuccessfulPolicyResponse.class, name="SuccessfulPolicyResponse"), + @Type(value = ServerError.class, name="500")}) +public interface Responses { - @JsonValue - private TypedObject value; - - private Responses(TypedObject value) { - this.value = value; - } + String httpStatusCode(); - public static Responses of(ResponsesSuccessfulPolicyResponse value) { - Utils.checkNotNull(value, "value"); - return new Responses(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); - } - - public static Responses of(ServerError value) { - Utils.checkNotNull(value, "value"); - return new Responses(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); - } - - /** - * Returns an instance of one of these types: - *
    - *
  • {@code com.styra.opa.openapi.models.shared.ResponsesSuccessfulPolicyResponse}
  • - *
  • {@code com.styra.opa.openapi.models.shared.ServerError}
  • - *
- * - *

Use {@code instanceof} to determine what type is returned. For example: - * - *

-     * if (obj.value() instanceof String) {
-     *     String answer = (String) obj.value();
-     *     System.out.println("answer=" + answer);
-     * }
-     * 
- * - * @return value of oneOf type - **/ - public java.lang.Object value() { - return value.value(); - } - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Responses other = (Responses) o; - return Objects.deepEquals(this.value.value(), other.value.value()); - } - - @Override - public int hashCode() { - return Objects.hash(value.value()); - } - - @SuppressWarnings("serial") - public static final class _Deserializer extends OneOfDeserializer { - - public _Deserializer() { - super(Responses.class, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); - } - } - - @Override - public String toString() { - return Utils.toString(Responses.class, - "value", value); - } - } diff --git a/src/main/java/com/styra/opa/openapi/models/shared/ResponsesSuccessfulPolicyResponse.java b/src/main/java/com/styra/opa/openapi/models/shared/ResponsesSuccessfulPolicyResponse.java index 07264d4..ec4be3a 100644 --- a/src/main/java/com/styra/opa/openapi/models/shared/ResponsesSuccessfulPolicyResponse.java +++ b/src/main/java/com/styra/opa/openapi/models/shared/ResponsesSuccessfulPolicyResponse.java @@ -20,7 +20,7 @@ import java.util.Optional; -public class ResponsesSuccessfulPolicyResponse { +public class ResponsesSuccessfulPolicyResponse implements Responses { /** * The base or virtual document referred to by the URL path. If the path is undefined, this key will be omitted. @@ -113,8 +113,9 @@ public Optional provenance() { } @JsonIgnore - public Optional httpStatusCode() { - return httpStatusCode; + @Override + public String httpStatusCode() { + return Utils.discriminatorToString(httpStatusCode); } public final static Builder builder() { diff --git a/src/main/java/com/styra/opa/openapi/models/shared/ServerError.java b/src/main/java/com/styra/opa/openapi/models/shared/ServerError.java index 01d6c77..6b1a353 100644 --- a/src/main/java/com/styra/opa/openapi/models/shared/ServerError.java +++ b/src/main/java/com/styra/opa/openapi/models/shared/ServerError.java @@ -19,7 +19,7 @@ import java.util.Optional; -public class ServerError { +public class ServerError implements Responses { @JsonProperty("code") private String code; @@ -86,8 +86,9 @@ public Optional decisionId() { } @JsonIgnore - public Optional httpStatusCode() { - return httpStatusCode; + @Override + public String httpStatusCode() { + return Utils.discriminatorToString(httpStatusCode); } public final static Builder builder() {