From c05b6ce18a461e3f23a22accbbec5f2eae79c8c5 Mon Sep 17 00:00:00 2001 From: thomas loubrieu <60993872+tloubrieu-jpl@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:13:23 -0500 Subject: [PATCH] change the swagger specification for python api_client fix 29 (#409) Co-authored-by: thomas loubrieu --- model/swagger.yml | 47 +++++++++++++------ .../SwaggerJavaProductsTransmuter.java | 14 +++--- .../controller/SwaggerJavaTransmuter.java | 4 +- .../main/resources/application.properties.aws | 2 +- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/model/swagger.yml b/model/swagger.yml index 0e39cec7..f7e9f0af 100644 --- a/model/swagger.yml +++ b/model/swagger.yml @@ -1350,21 +1350,22 @@ components: content: "*": schema: - type: array - items: - type: object - properties: - property: - type: string - type: - type: string - enum: - - "string" - - "integer" - - "float" - - "boolean" - - "timestamp" - - "unsupported" + type: object + "*/*": + schema: + $ref: '#/components/schemas/propertiesList' + application/json: + schema: + $ref: '#/components/schemas/propertiesList' + application/xml: + schema: + $ref: '#/components/schemas/propertiesList' + text/html: + schema: + $ref: '#/components/schemas/propertiesList' + text/xml: + schema: + $ref: '#/components/schemas/propertiesList' Singular: description: Successful request content: @@ -1402,6 +1403,22 @@ components: schema: $ref: '#/components/schemas/pdsProduct' schemas: + propertiesList: + type: array + items: + type: object + properties: + property: + type: string + type: + type: string + enum: + - "string" + - "integer" + - "float" + - "boolean" + - "timestamp" + - "unsupported" summary: type: object properties: diff --git a/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaProductsTransmuter.java b/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaProductsTransmuter.java index 0824f2b7..5321d6d6 100644 --- a/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaProductsTransmuter.java +++ b/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaProductsTransmuter.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; import gov.nasa.pds.api.base.PropertiesApi; import gov.nasa.pds.api.registry.model.identifiers.PdsProductIdentifier; -import gov.nasa.pds.model.ProductPropertiesList200ResponseInner; +import gov.nasa.pds.model.PropertiesListInner; import jakarta.validation.Valid; import jakarta.validation.constraints.Min; import org.opensearch.client.RequestOptions; @@ -129,7 +129,7 @@ public ResponseEntity selectByLidvidLatest(String identifier, } @Override - public ResponseEntity> productPropertiesList() { + public ResponseEntity productPropertiesList() { try { String registryIndexName = this.getConnection().getRegistryIndex(); @@ -156,20 +156,20 @@ public ResponseEntity> productProper "float", "float", "double", "float"); - List results = new ArrayList<>(); + List results = new ArrayList<>(); content .fieldNames() .forEachRemaining( (String propertyName) -> { - ProductPropertiesList200ResponseInner propertyElement = - new ProductPropertiesList200ResponseInner(); + PropertiesListInner propertyElement = + new PropertiesListInner(); propertyElement.setProperty(propertyName); String rawType = content.get(propertyName).get("type").asText(); String displayType = displayTypesByDbType.getOrDefault(rawType, "unsupported"); - ProductPropertiesList200ResponseInner.TypeEnum enumType = - ProductPropertiesList200ResponseInner.TypeEnum.fromValue(displayType); + PropertiesListInner.TypeEnum enumType = + PropertiesListInner.TypeEnum.fromValue(displayType); propertyElement.setType(enumType); results.add(propertyElement); diff --git a/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaTransmuter.java b/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaTransmuter.java index 435e246a..00e2fe66 100644 --- a/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaTransmuter.java +++ b/service/src/main/java/gov/nasa/pds/api/registry/controller/SwaggerJavaTransmuter.java @@ -4,7 +4,7 @@ import java.util.List; import java.util.Map; import gov.nasa.pds.api.base.PropertiesApi; -import gov.nasa.pds.model.ProductPropertiesList200ResponseInner; +import gov.nasa.pds.model.PropertiesListInner; import jakarta.validation.Valid; import jakarta.validation.constraints.Min; import org.antlr.v4.runtime.NoViableAltException; @@ -465,7 +465,7 @@ public ResponseEntity classMembersVers(String propertyClass, String iden } @Override - public ResponseEntity> productPropertiesList() { + public ResponseEntity productPropertiesList() { // TODO Auto-generated method stub return super.productPropertiesList(); } diff --git a/service/src/main/resources/application.properties.aws b/service/src/main/resources/application.properties.aws index 2500217a..4b76a5a9 100644 --- a/service/src/main/resources/application.properties.aws +++ b/service/src/main/resources/application.properties.aws @@ -39,4 +39,4 @@ openSearch.ssl=true filter.archiveStatus=archived,certified # source version - this needs to be manually updated for AWS ECR docker images -registry.service.version=1.2.0 +registry.service.version=1.4.0