From f7f06f0147b853a33b17df4ced7cf11ca2f54bba Mon Sep 17 00:00:00 2001 From: AbstractionFactory <179820029+abstractionfactory@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:15:15 +0200 Subject: [PATCH] Cleaning up flipflopping generated OpenAPI doc due to goswagger conflicts Signed-off-by: AbstractionFactory <179820029+abstractionfactory@users.noreply.github.com> --- backend/go.mod | 2 +- backend/go.sum | 2 ++ backend/internal/moduleindex/module.go | 2 +- .../providertypes/provider_addr.go | 2 +- backend/internal/server/openapi.yml | 25 ++++++++++--------- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/backend/go.mod b/backend/go.mod index 26f7b663..79c4ca18 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -9,7 +9,7 @@ require ( github.com/go-enry/go-license-detector/v4 v4.3.1 github.com/lib/pq v1.10.9 github.com/mitchellh/go-spdx v0.1.0 - github.com/opentofu/libregistry v0.0.0-20240902143137-5bc965332079 + github.com/opentofu/libregistry v0.0.0-20240904084317-6fa867eafe63 github.com/opentofu/tofudl v0.0.0-20240730151408-3bd8529dae09 github.com/opentofu/tofutestutils v0.0.0-20240821111804-5fcfb797e0a7 golang.org/x/sync v0.8.0 diff --git a/backend/go.sum b/backend/go.sum index 1bf4bd78..76d0822a 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -223,6 +223,8 @@ github.com/opentofu/libregistry v0.0.0-20240902140652-883944ac1490 h1:GrgjoNMwx1 github.com/opentofu/libregistry v0.0.0-20240902140652-883944ac1490/go.mod h1:irS/XyfQZdwi3Ggm105FfDyj3d9deFAi5GraORIeMsI= github.com/opentofu/libregistry v0.0.0-20240902143137-5bc965332079 h1:GdkIdGChrfnE4C/HkDsnffddAm3Qd4pms1gO/sf1GJ4= github.com/opentofu/libregistry v0.0.0-20240902143137-5bc965332079/go.mod h1:irS/XyfQZdwi3Ggm105FfDyj3d9deFAi5GraORIeMsI= +github.com/opentofu/libregistry v0.0.0-20240904084317-6fa867eafe63 h1:mpdO99YRPoMsdjHgc/I7DUrDvgUict9O9KeKfvdlTs0= +github.com/opentofu/libregistry v0.0.0-20240904084317-6fa867eafe63/go.mod h1:irS/XyfQZdwi3Ggm105FfDyj3d9deFAi5GraORIeMsI= github.com/opentofu/registry-address v0.0.0-20230922120653-901b9ae4061a h1:NyM/PPbc+kxxv2d4OKfE32C5fLtVTLceyg4YKKCYO9Y= github.com/opentofu/registry-address v0.0.0-20230922120653-901b9ae4061a/go.mod h1:HzQhpVo/NJnGmN+7FPECCVCA5ijU7AUcvf39enBKYOc= github.com/opentofu/tofudl v0.0.0-20240730151408-3bd8529dae09 h1:bA3Dy3Be9o896wdcQhK0Ky2Eco0ZwCWZgt73dSaYuDI= diff --git a/backend/internal/moduleindex/module.go b/backend/internal/moduleindex/module.go index faf226d8..53f5bb70 100644 --- a/backend/internal/moduleindex/module.go +++ b/backend/internal/moduleindex/module.go @@ -42,7 +42,7 @@ func (m *Module) Validate() error { // // swagger:model type ModuleAddr struct { - module.Addr + module.Addr `json:"-"` // Contains the display version of the addr presentable to the end user. This may be // capitalized. diff --git a/backend/internal/providerindex/providertypes/provider_addr.go b/backend/internal/providerindex/providertypes/provider_addr.go index 91f9e057..e7c7c38e 100644 --- a/backend/internal/providerindex/providertypes/provider_addr.go +++ b/backend/internal/providerindex/providertypes/provider_addr.go @@ -19,7 +19,7 @@ func Addr(addr provider.Addr) ProviderAddr { // // swagger:model type ProviderAddr struct { - provider.Addr + provider.Addr `json:"-"` // Display contains the user-readable display variant of this addr. This may be capitalized. // required: true diff --git a/backend/internal/server/openapi.yml b/backend/internal/server/openapi.yml index e616c371..00a31b2a 100644 --- a/backend/internal/server/openapi.yml +++ b/backend/internal/server/openapi.yml @@ -1,9 +1,4 @@ definitions: - Addr: - description: |- - Addr describes a module address combination of NAMESPACE-NAME-TARGETSYSTEM. This will translate to - github.com/NAMESPACE/terraform-TARGETSYSTEM-NAME for now. - type: object BaseDetails: properties: edit_link: @@ -360,7 +355,7 @@ definitions: description: Examples lists all examples for this version. type: object id: - $ref: '#/definitions/VersionNumber' + $ref: '#/definitions/ModuleVersionNumber' incompatible_license: description: IncompatibleLicense indicates that there are no licenses or there is one or more license that are not approved. type: boolean @@ -423,7 +418,7 @@ definitions: ModuleVersionDescriptor: properties: id: - $ref: '#/definitions/VersionNumber' + $ref: '#/definitions/ModuleVersionNumber' published: format: date-time type: string @@ -432,6 +427,12 @@ definitions: - published title: ModuleVersionDescriptor describes a single version. type: object + ModuleVersionNumber: + description: |- + VersionNumber describes the semver version number. Note that in contrast to provider versions module versions + do not have a compulsory "v" prefix. Call ToVCSVersion() before you call Normalize() in order to get the correct + VCS version. + type: string Output: properties: description: @@ -570,7 +571,7 @@ definitions: docs: $ref: '#/definitions/ProviderDocs' id: - $ref: '#/definitions/VersionNumber' + $ref: '#/definitions/ProviderVersionNumber' incompatible_license: description: IncompatibleLicense indicates that there are no licenses or there is one or more license that are not approved. type: boolean @@ -593,7 +594,7 @@ definitions: ProviderVersionDescriptor: properties: id: - $ref: '#/definitions/VersionNumber' + $ref: '#/definitions/ProviderVersionNumber' published: format: date-time type: string @@ -602,6 +603,9 @@ definitions: - published title: ProviderVersionDescriptor describes a provider version. type: object + ProviderVersionNumber: + title: VersionNumber describes the semver version number. + type: string Resource: properties: address: @@ -725,9 +729,6 @@ definitions: - required title: Variable describes a variable as the UI expects it. type: object - VersionNumber: - title: VersionNumber describes the semver version number. - type: string host: api.opentofu.org info: description: The API to fetch documentation index and documentation files from the OpenTofu registry.