diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 00000000..f227cf2d --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.7.0" + } +} diff --git a/server/csharp.ps1 b/server/csharp.ps1 index a35c6e4d..4e0a7ec3 100644 --- a/server/csharp.ps1 +++ b/server/csharp.ps1 @@ -1,11 +1,10 @@ -$version = &"$PSScriptRoot\get-version.ps1" -patchVersion "1" $additionalProperties = @{ packageName = "Trinsic.Connect.BackendClient" - packageVersion = $version + packageVersion = "[VERSION]" nullableReferenceTypes = "true" modelPropertySorting = "alphabetical" library = "httpclient" useDateTimeOffset = "true" validatable = "false" } -& "$PSScriptRoot\generate-client.ps1" -language "csharp" -additionalProperties $additionalProperties \ No newline at end of file +& "$PSScriptRoot/generate-client.ps1" -language "csharp" -patchVersion "1" -additionalProperties $additionalProperties \ No newline at end of file diff --git a/server/generate-all.ps1 b/server/generate-all.ps1 deleted file mode 100644 index 639a79c0..00000000 --- a/server/generate-all.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -& "$PSScriptRoot\csharp.ps1" -& "$PSScriptRoot\go.ps1" -& "$PSScriptRoot\java.ps1" -& "$PSScriptRoot\node.ps1" -& "$PSScriptRoot\php.ps1" -& "$PSScriptRoot\python.ps1" -& "$PSScriptRoot\ruby.ps1" \ No newline at end of file diff --git a/server/generate-client.ps1 b/server/generate-client.ps1 index bc592a16..a29b8127 100644 --- a/server/generate-client.ps1 +++ b/server/generate-client.ps1 @@ -2,19 +2,19 @@ param ( [Parameter(Mandatory = $true)] [string]$language, + [Parameter(Mandatory = $true)] + [string]$patchVersion, [string]$swaggerFileOrUrl = "https://connect.trinsic.id/swagger/api/swagger.json", - [string]$outputFolder = "../dist/$language", + [string]$outputFolder = "$PSScriptRoot/../dist/$language", [Parameter(Mandatory = $true)] [hashtable]$additionalProperties ) -#Ensure we run this "from this folder" as we run it personally in a command line as well as through the perspective of builds. -Set-Location -Path "$PSScriptRoot" $localSwaggerFilePath = ""; if ($swaggerFileOrUrl -like "https://*") { Write-Host "The URL starts with https://, retrieving the file" Write-Host "Downloading specification from $swaggerFileOrUrl"; - $localSwaggerFilePath = "./swagger.json"; + $localSwaggerFilePath = "$PSScriptRoot/swagger.json"; $response = Invoke-WebRequest -Uri $swaggerFileOrUrl $response.Content | Out-File -FilePath $localSwaggerFilePath -Encoding utf8 @@ -41,9 +41,11 @@ else { Write-Host "Created output folder"; } -# Concatenate the hashtable into a comma-separated string +$version = &"$PSScriptRoot\get-version.ps1" -patchVersion $patchVersion; + +# Concatenate the hashtable into a comma-separated string and replace version variable $concatenatedAdditionalProperties = (($additionalProperties.GetEnumerator() | ForEach-Object { - "$($_.Key)=$($_.Value)" + "$($_.Key)=$($_.Value -replace "\[VERSION\]", $version)" }) -join ','); Write-Host "Generating $language SDK from $localSwaggerFilePath in $outputFolder with additional properties: $concatenatedAdditionalProperties"; diff --git a/server/get-version.ps1 b/server/get-version.ps1 index e1ba5445..b6378e39 100644 --- a/server/get-version.ps1 +++ b/server/get-version.ps1 @@ -5,9 +5,9 @@ param ( ) # Because there's a lot of small variations in version number usage across generators, generate version first and provide it via additonal properties to the generate-client.ps1 file. # Other option was a lot of if language specific if statements inside of generate-client. -$jsonContent = Get-Content -Path "version.json" -Raw | ConvertFrom-Json -$apiVersion = $jsonContent.apiVersion -$packageVersion = "$apiVersion.$patchVersion" +$jsonContent = Get-Content -Path "$PSScriptRoot\..\versions.json" -Raw | ConvertFrom-Json +$backendVersion = $jsonContent.backendVersion +$packageVersion = "$backendVersion.$patchVersion" Write-Host "Package will be created with version $packageVersion from file based API Version $version and patchVersion $patchVersion" return $packageVersion; \ No newline at end of file diff --git a/server/go.ps1 b/server/go.ps1 index b3b33090..fbfce5e9 100644 --- a/server/go.ps1 +++ b/server/go.ps1 @@ -1,6 +1,5 @@ -$version = &"$PSScriptRoot\get-version.ps1" -patchVersion "1" $additionalProperties = @{ packageName = "trinsic.id/connect-sdks/go" - packageVersion = $version + packageVersion = "[VERSION]" } -& "$PSScriptRoot\generate-client.ps1" -language "go" -additionalProperties $additionalProperties \ No newline at end of file +& "$PSScriptRoot\generate-client.ps1" -language "go" -patchVersion "1" -additionalProperties $additionalProperties \ No newline at end of file diff --git a/server/java.ps1 b/server/java.ps1 index 3292827c..b33f3052 100644 --- a/server/java.ps1 +++ b/server/java.ps1 @@ -1,7 +1,6 @@ -$version = &"$PSScriptRoot\get-version.ps1" -patchVersion "1" $additionalProperties = @{ apiPackage = "id.trinsic.connect.backendclient" - artifactVersion = $version + artifactVersion = "[VERSION]" library = "native" modelPackage = "id.trinsic.connect.backendclient.models" artifactId = "connect-backendclient" @@ -16,4 +15,4 @@ $additionalProperties = @{ developerOrganizationUrl = "https://trinsic.id" artifactDescription = "'Trinsic Connect Backend Client'" } -& "$PSScriptRoot\generate-client.ps1" -language "java" -additionalProperties $additionalProperties \ No newline at end of file +& "$PSScriptRoot/generate-client.ps1" -language "java" -patchVersion "1" -additionalProperties $additionalProperties \ No newline at end of file diff --git a/server/node.ps1 b/server/node.ps1 index d013fd77..31c7da10 100644 --- a/server/node.ps1 +++ b/server/node.ps1 @@ -1,8 +1,7 @@ -$version = &"$PSScriptRoot\get-version.ps1" -patchVersion "1" $additionalProperties = @{ npmName = "@trinsic/connect-backend-client" - npmVersion = $version + npmVersion = "[VERSION]" supportsES6 = "true" npmRepository = "https://github.com/trinsic-id" } -& "$PSScriptRoot\generate-client.ps1" -language "typescript-fetch" -additionalProperties $additionalProperties \ No newline at end of file +& "$PSScriptRoot/generate-client.ps1" -language "typescript-fetch" -patchVersion "1" -additionalProperties $additionalProperties \ No newline at end of file diff --git a/server/php.ps1 b/server/php.ps1 index f5fcd5be..a09ddaaf 100644 --- a/server/php.ps1 +++ b/server/php.ps1 @@ -1,10 +1,9 @@ -$version = &"$PSScriptRoot\get-version.ps1" -patchVersion "1" $additionalProperties = @{ - artifactVersion = $version + artifactVersion = "[VERSION]" invokerPackage = "TrinsicConnect\\BackendClient" artifactUrl = "https://trinsic.id" developerOrganization = "Trinsic" developerOrganizationUrl = "https://trinsic.id" composerPackageName = "trinsic/connect-backend-client" } -& "$PSScriptRoot\generate-client.ps1" -language "php" -additionalProperties $additionalProperties \ No newline at end of file +& "$PSScriptRoot/generate-client.ps1" -language "php" -patchVersion "1" -additionalProperties $additionalProperties \ No newline at end of file diff --git a/server/python.ps1 b/server/python.ps1 index 36121e72..cbd9aa1f 100644 --- a/server/python.ps1 +++ b/server/python.ps1 @@ -1,8 +1,7 @@ -$version = &"$PSScriptRoot\get-version.ps1" -patchVersion "1" $additionalProperties = @{ packageName = "trinsic_connect_backend_client" - packageVersion = $version + packageVersion = "[VERSION]" packageUrl = "https://trinsic.id" projectName = "Trinsic-Connect-Backend-Client" } -& "$PSScriptRoot\generate-client.ps1" -language "python" -additionalProperties $additionalProperties \ No newline at end of file +& "$PSScriptRoot/generate-client.ps1" -language "python" -patchVersion "1" -additionalProperties $additionalProperties \ No newline at end of file diff --git a/server/ruby.ps1 b/server/ruby.ps1 index 391459e9..b6d776d8 100644 --- a/server/ruby.ps1 +++ b/server/ruby.ps1 @@ -1,4 +1,3 @@ -$version = &"$PSScriptRoot\get-version.ps1" -patchVersion "1" $additionalProperties = @{ gemAuthor = "Trinsic" gemAuthorEmail = "support@trinsic.id" @@ -6,7 +5,7 @@ $additionalProperties = @{ gemHomepage = "https://trinsic.id" gemName = "trinsic_connect_backendclient" gemSummary = "'Trinsic Connect Backend Client'" - gemVersion = $version + gemVersion = "[VERSION]" moduleName = "TrinsicConnectBackendClient" } -& "$PSScriptRoot\generate-client.ps1" -language "ruby" -additionalProperties $additionalProperties \ No newline at end of file +& "$PSScriptRoot/generate-client.ps1" -language "ruby" -patchVersion "1" -additionalProperties $additionalProperties \ No newline at end of file diff --git a/server/version.json b/server/version.json deleted file mode 100644 index c8395f81..00000000 --- a/server/version.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "apiVersion": "0.1" -} diff --git a/versions.json b/versions.json new file mode 100644 index 00000000..3fd11be6 --- /dev/null +++ b/versions.json @@ -0,0 +1,3 @@ +{ + "backendVersion": "0.1" +}