Skip to content

Commit

Permalink
chore: fix schema for swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentC35 committed Jun 6, 2024
1 parent 68fdee9 commit 3f20235
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import fr.insee.pogues.metadata.model.pogues.DataCollectionContext;
import fr.insee.pogues.metadata.service.MetadataService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
Expand All @@ -33,31 +34,31 @@ public class MetadataController {

@GetMapping("meta-data/units")
@Operation(operationId = "getUnits", summary = "Get units measure", description = "This will give a list of objects containing the uri and the label for all units", responses = {
@ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = "List", implementation = Unit.class))) })
@ApiResponse(content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Unit.class)))) })
public ResponseEntity<List<Unit>> getUnits() throws Exception {
List<Unit> units = metadataService.getUnits();
return ResponseEntity.status(HttpStatus.OK).body(units);
}

@GetMapping("search/series")
@Operation(operationId = "getSeries", summary = "Get all series", description = "This will give a list of series via magma", responses = {
@ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = "List", implementation = DataCollection.class))) })
@ApiResponse(content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = DataCollection.class)))) })
public ResponseEntity<List<DataCollection>> getSeries() throws Exception {
List<DataCollection> series = metadataService.getSeries();
return ResponseEntity.status(HttpStatus.OK).body(series);
}

@GetMapping("search/series/{id}/operations")
@Operation(operationId = "getOperationsBySerie", summary = "Get operations by serie id", description = "This will give a list of operations according to serie id via magma", responses = {
@ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = "List", implementation = DataCollection.class))) })
@ApiResponse(content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = DataCollection.class)))) })
public ResponseEntity<List<DataCollection>> getOperationsBySerie(@PathVariable(value = "id") String id) throws Exception {
List<DataCollection> operations = metadataService.getOperationsByIdSerie(id);
return ResponseEntity.status(HttpStatus.OK).body(operations);
}

@GetMapping("search/operations/{id}/collections")
@Operation(operationId = "getCollectionsByOperation", summary = "Get dataCollection by serie collection", description = "This will give a list of data-collections according to operation id via magma", responses = {
@ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(type = "List", implementation = DataCollection.class))) })
@ApiResponse(content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = DataCollection.class)))) })
public ResponseEntity<List<DataCollection>> getDataCollectionByOperation(@PathVariable(value = "id") String id) throws Exception {
List<DataCollection> operations = metadataService.getColletionsByIdOperation(id);
return ResponseEntity.status(HttpStatus.OK).body(operations);
Expand Down

0 comments on commit 3f20235

Please sign in to comment.