Skip to content

Commit

Permalink
change the swagger specification for python api_client fix 29 (#409)
Browse files Browse the repository at this point in the history
Co-authored-by: thomas loubrieu <thomas.loubrieu@jpl.nasa.gov>
  • Loading branch information
tloubrieu-jpl and thomas loubrieu committed Feb 26, 2024
1 parent 569315a commit c05b6ce
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 25 deletions.
47 changes: 32 additions & 15 deletions model/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -129,7 +129,7 @@ public ResponseEntity<Object> selectByLidvidLatest(String identifier,
}

@Override
public ResponseEntity<List<ProductPropertiesList200ResponseInner>> productPropertiesList() {
public ResponseEntity<Object> productPropertiesList() {

try {
String registryIndexName = this.getConnection().getRegistryIndex();
Expand All @@ -156,20 +156,20 @@ public ResponseEntity<List<ProductPropertiesList200ResponseInner>> productProper
"float", "float",
"double", "float");

List<ProductPropertiesList200ResponseInner> results = new ArrayList<>();
List<PropertiesListInner> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -465,7 +465,7 @@ public ResponseEntity<Object> classMembersVers(String propertyClass, String iden
}

@Override
public ResponseEntity<List<ProductPropertiesList200ResponseInner>> productPropertiesList() {
public ResponseEntity<Object> productPropertiesList() {
// TODO Auto-generated method stub
return super.productPropertiesList();
}
Expand Down
2 changes: 1 addition & 1 deletion service/src/main/resources/application.properties.aws
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c05b6ce

Please sign in to comment.