From b24a06648057756e7b4901af6a38d52232969758 Mon Sep 17 00:00:00 2001 From: zia alborzi Date: Thu, 4 Apr 2024 13:39:52 +0200 Subject: [PATCH 1/3] yaml files + no security generation in application --- src/main/openapi/.gitignore | 4 ---- src/main/openapi/ckan.yaml | 0 src/main/openapi/discovery.yaml | 0 3 files changed, 4 deletions(-) delete mode 100644 src/main/openapi/.gitignore create mode 100644 src/main/openapi/ckan.yaml create mode 100644 src/main/openapi/discovery.yaml diff --git a/src/main/openapi/.gitignore b/src/main/openapi/.gitignore deleted file mode 100644 index ad81c5d..0000000 --- a/src/main/openapi/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-FileCopyrightText: 2024 PNED G.I.E. -# -# SPDX-License-Identifier: Apache-2.0 -## TODO - this file is just a placeholder \ No newline at end of file diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml new file mode 100644 index 0000000..e69de29 diff --git a/src/main/openapi/discovery.yaml b/src/main/openapi/discovery.yaml new file mode 100644 index 0000000..e69de29 From b32f98f5fbf06fc02a23c65a4aa2d638e77dec50 Mon Sep 17 00:00:00 2001 From: zia alborzi Date: Thu, 4 Apr 2024 13:40:16 +0200 Subject: [PATCH 2/3] yaml files + no security generation in application --- pom.xml | 10 +- src/main/openapi/ckan.yaml | 179 ++++++++++++++++++++ src/main/openapi/discovery.yaml | 192 ++++++++++++++++++++++ src/main/resources/application.properties | 3 + 4 files changed, 381 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index de3cf0b..2f751c1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,8 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 io.github.genomicdatainfrastructure gdi-userportal-dataset-discovery-service @@ -81,6 +81,10 @@ io.quarkus quarkus-oidc + + io.quarkus + quarkus-oidc-client + io.quarkus quarkus-junit5 diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml index e69de29..4241ee9 100644 --- a/src/main/openapi/ckan.yaml +++ b/src/main/openapi/ckan.yaml @@ -0,0 +1,179 @@ +openapi: 3.0.3 +info: + title: CKAN Package Search API + version: 1.0.0 + description: API for searching CKAN packages using various criteria. +servers: + - url: http://example.com/api/3/action +paths: + /package_search: + get: + summary: Searches for packages based on criteria + operationId: packageSearch + parameters: + - name: q + in: query + description: Solr search query + required: false + schema: + type: string + default: "*:*" + - name: fq + in: query + description: Filter query to apply + required: false + schema: + type: string + - name: fq_list + in: query + description: Additional filter queries + required: false + style: form + explode: true + schema: + type: array + items: + type: string + - name: sort + in: query + description: Sorting of search results + required: false + schema: + type: string + default: "score desc, metadata_modified desc" + - name: rows + in: query + description: Max number of rows to return + required: false + schema: + type: integer + default: 10 + maximum: 1000 + - name: start + in: query + description: Offset in the complete result set + required: false + schema: + type: integer + - name: facet + in: query + description: Whether to enable faceted results + required: false + schema: + type: string + default: "true" + responses: + '200': + description: A list of packages matching the search criteria + content: + application/json: + schema: + type: object + properties: + count: + type: integer + description: The number of results found + results: + type: array + items: + $ref: '#/components/schemas/Dataset' + search_facets: + type: object + additionalProperties: true + description: Aggregated information about facet counts +components: + schemas: + Dataset: + type: object + properties: + id: + type: string + title: + type: string + source: + type: string + version: + type: string + author: + type: string + authorEmail: + type: string + maintainer: + type: string + maintainerEmail: + type: string + contactURI: + type: string + contactName: + type: string + contactEmail: + type: string + publisher: + type: string + publisherName: + type: string + publisherEmail: + type: string + publisherURL: + type: string + publisherType: + type: string + spatialURI: + type: string + temporalStartDate: + type: string + temporalEndDate: + type: string + theme: + type: string + versionNotes: + type: string + landingPage: + type: string + spatialResolutionInMeters: + type: string + temporalResolution: + type: string + qualifiedRelation: + type: string + accessRights: + type: string + frequency: + type: string + conformsTo: + type: string + creator: + type: string + isReferencedBy: + type: string + isVersionOf: + type: string + identifier: + type: string + issued: + type: string + language: + type: string + modificationDate: + type: string + provenance: + type: string + relation: + type: string + sample: + type: string + type: + type: string + hasVersion: + type: string + documentation: + type: string + qualifiedAttribution: + type: string + wasGeneratedBy: + type: string + alternateIdentifier: + type: string + required: + - id + - title diff --git a/src/main/openapi/discovery.yaml b/src/main/openapi/discovery.yaml index e69de29..73abdff 100644 --- a/src/main/openapi/discovery.yaml +++ b/src/main/openapi/discovery.yaml @@ -0,0 +1,192 @@ +openapi: 3.0.3 +info: + title: CKAN Package Search API + version: 1.0.0 + description: API for searching CKAN packages using various criteria. +servers: + - url: http://example.com/api/3/action +paths: + /package_search: + get: + summary: Searches for packages based on criteria + operationId: packageSearch + parameters: + - name: q + in: query + description: Solr search query + required: false + schema: + type: string + default: "*:*" + - name: fq + in: query + description: Filter query to apply + required: false + schema: + type: string + - name: fq_list + in: query + description: Additional filter queries + required: false + style: form + explode: true + schema: + type: array + items: + type: string + - name: sort + in: query + description: Sorting of search results + required: false + schema: + type: string + default: "score desc, metadata_modified desc" + - name: rows + in: query + description: Max number of rows to return + required: false + schema: + type: integer + default: 10 + maximum: 1000 + - name: start + in: query + description: Offset in the complete result set + required: false + schema: + type: integer + - name: facet + in: query + description: Whether to enable faceted results + required: false + schema: + type: string + default: "true" + responses: + '200': + description: A list of packages matching the search criteria + content: + application/json: + schema: + type: object + properties: + count: + type: integer + description: The number of results found + results: + type: array + items: + $ref: '#/components/schemas/Dataset' + search_facets: + type: object + additionalProperties: true + description: Aggregated information about facet counts + security: + - discovery_auth: + - read:datasets +components: + securitySchemes: + discovery_auth: + type: oauth2 + description: This API uses OAuth 2 with the implicit grant flow. + flows: + authorizationCode: + tokenUrl: https://api.example.com/oauth2/token + authorizationUrl: https://api.example.com/oauth2/authorize + scopes: + read:datasets: read datasets + schemas: + Dataset: + type: object + properties: + id: + type: string + title: + type: string + source: + type: string + version: + type: string + author: + type: string + authorEmail: + type: string + maintainer: + type: string + maintainerEmail: + type: string + contactURI: + type: string + contactName: + type: string + contactEmail: + type: string + publisher: + type: string + publisherName: + type: string + publisherEmail: + type: string + publisherURL: + type: string + publisherType: + type: string + spatialURI: + type: string + temporalStartDate: + type: string + temporalEndDate: + type: string + theme: + type: string + versionNotes: + type: string + landingPage: + type: string + spatialResolutionInMeters: + type: string + temporalResolution: + type: string + qualifiedRelation: + type: string + accessRights: + type: string + frequency: + type: string + conformsTo: + type: string + creator: + type: string + isReferencedBy: + type: string + isVersionOf: + type: string + identifier: + type: string + issued: + type: string + language: + type: string + modificationDate: + type: string + provenance: + type: string + relation: + type: string + sample: + type: string + type: + type: string + hasVersion: + type: string + documentation: + type: string + qualifiedAttribution: + type: string + wasGeneratedBy: + type: string + alternateIdentifier: + type: string + required: + - id + - title diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 508dee0..869eeaf 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -15,3 +15,6 @@ quarkus.oidc.credentials.secret=secret quarkus.http.auth.permission.authenticated.paths=/api/* quarkus.http.auth.permission.authenticated.policy=authenticated quarkus.keycloak.policy-enforcer.lazy-load-paths=false +quarkus.openapi-generator.codegen.spec.ckan_yaml.enable-security-generation=false +quarkus.openapi-generator.codegen.spec.discovery_yaml.enable-security-generation=false + From 122446373c6e239ed7aff7bfcdf927ca23c659b6 Mon Sep 17 00:00:00 2001 From: zia alborzi Date: Thu, 4 Apr 2024 13:55:06 +0200 Subject: [PATCH 3/3] feat: yaml files + no security generation in application --- src/main/openapi/ckan.yaml | 4 ++++ src/main/openapi/discovery.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml index 4241ee9..70d3e0f 100644 --- a/src/main/openapi/ckan.yaml +++ b/src/main/openapi/ckan.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 PNED G.I.E. +# +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.3 info: title: CKAN Package Search API diff --git a/src/main/openapi/discovery.yaml b/src/main/openapi/discovery.yaml index 73abdff..3fc5c43 100644 --- a/src/main/openapi/discovery.yaml +++ b/src/main/openapi/discovery.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 PNED G.I.E. +# +# SPDX-License-Identifier: Apache-2.0 + openapi: 3.0.3 info: title: CKAN Package Search API