Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API / Improve OpenAPI spec schema. #8602

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions services/src/main/java/org/fao/geonet/api/OpenApiConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
package org.fao.geonet.api;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.servers.ServerVariable;
import io.swagger.v3.oas.models.servers.ServerVariables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
package org.fao.geonet.api.records;

import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.Explode;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.enums.ParameterStyle;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down Expand Up @@ -167,7 +171,15 @@ ResponseEntity<Element> processRecordPreview(
public @ResponseBody
ResponseEntity processRecord(
@Parameter(description = API_PARAM_RECORD_UUID, required = true) @PathVariable String metadataUuid,
@Parameter(description = ApiParams.API_PARAM_PROCESS_ID) @PathVariable String process, HttpServletRequest request)
@Parameter(description = ApiParams.API_PARAM_PROCESS_ID, example = "thumbnail-add") @PathVariable String process,
@Parameter(name = "processParams", description = "Parameters to pass to the process",
in = ParameterIn.QUERY,
required = false,
schema = @Schema(type = "object", additionalProperties = Schema.AdditionalPropertiesValue.TRUE, example = "{\"thumbnail_url\":\"http://\",\"thumbnail_desc\":\"Dataset overview\"}"),
style = ParameterStyle.FORM,
explode = Explode.TRUE)
@RequestParam(required = false) Map<String,String> processParams,
HttpServletRequest request)
throws Exception {
AbstractMetadata metadata = ApiUtils.canEditRecord(metadataUuid, request);
boolean save = true;
Expand Down
20 changes: 19 additions & 1 deletion services/src/main/java/org/fao/geonet/api/site/SiteApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,29 @@ public static void reloadServices(ServiceContext context) throws Exception {
summary = "Get site (or portal) description",
description = "")
@RequestMapping(
consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.ALL_VALUE},
produces = MediaType.APPLICATION_JSON_VALUE,
method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Site description.")
@ApiResponse(responseCode = "200", description = "Site description.",
content = {
@Content(schema = @Schema(
type = "object",
additionalPropertiesSchema = String.class
),
examples = @ExampleObject(value = "{\n" +
" \"system/site/name\": \"My GeoNetwork catalogue\",\n" +
" \"system/site/organization\": \"My organization\",\n" +
" \"system/site/siteId\": \"33bc8c82-7ac2-49b6-a22b-af7376dbcf10\",\n" +
" \"system/platform/version\": \"4.4.7\",\n" +
" \"system/platform/subVersion\": \"SNAPSHOT\",\n" +
" \"node/default\": \"true\",\n" +
" \"node/id\": \"33bc8c82-7ac2-49b6-a22b-af7376dbcf10\",\n" +
" \"node/name\": \"My GeoNetwork catalogue\",\n" +
" \"microservices/enabled\": false\n" +
"}"))
})
})
@ResponseBody
public SettingsListResponse getSiteOrPortalDescription(
Expand Down
Loading