From c2489e5c0af204d68fb135537461193f10215deb Mon Sep 17 00:00:00 2001 From: Vladimiras Desiatnikovas Date: Fri, 29 Mar 2024 13:41:22 +0200 Subject: [PATCH] Updated after comments from 2024-03-05 Signed-off-by: Vladimiras Desiatnikovas --- openapi/components/responses/error400.yaml | 4 -- openapi/components/responses/error403.yaml | 9 --- openapi/components/responses/error404.yaml | 4 -- openapi/components/schemas/URI.yaml | 2 + openapi/components/schemas/URL.yaml | 2 + openapi/components/schemas/absent.yaml | 7 ++ openapi/components/schemas/array.yaml | 2 + openapi/components/schemas/backref.yaml | 3 + openapi/components/schemas/binary.yaml | 3 + openapi/components/schemas/boolean.yaml | 10 +++ openapi/components/schemas/date.yaml | 13 ++++ openapi/components/schemas/dateTime.yaml | 11 +++ openapi/components/schemas/error.yaml | 50 +++++++++---- openapi/components/schemas/file.yaml | 14 ++++ openapi/components/schemas/generic.yaml | 10 +++ openapi/components/schemas/geometry.yaml | 83 ++++++++++++++++++++++ openapi/components/schemas/image.yaml | 3 + openapi/components/schemas/integer.yaml | 4 ++ openapi/components/schemas/money.yaml | 2 + openapi/components/schemas/number.yaml | 2 + openapi/components/schemas/object.yaml | 26 ++++++- openapi/components/schemas/ref.yaml | 22 ++++-- openapi/components/schemas/spatial.yaml | 2 + openapi/components/schemas/string.yaml | 2 + openapi/components/schemas/temporal.yaml | 2 + openapi/components/schemas/text.yaml | 2 + openapi/components/schemas/time.yaml | 13 ++++ openapi/openapi.yaml | 76 ++++++++++++++------ openapi/paths/file.yaml | 17 ++++- openapi/paths/model.yaml | 23 +++++- openapi/paths/object.yaml | 43 ++++++++--- openapi/paths/wipe.yaml | 4 +- 32 files changed, 393 insertions(+), 77 deletions(-) create mode 100644 openapi/components/schemas/URI.yaml create mode 100644 openapi/components/schemas/URL.yaml create mode 100644 openapi/components/schemas/absent.yaml create mode 100644 openapi/components/schemas/array.yaml create mode 100644 openapi/components/schemas/backref.yaml create mode 100644 openapi/components/schemas/binary.yaml create mode 100644 openapi/components/schemas/boolean.yaml create mode 100644 openapi/components/schemas/date.yaml create mode 100644 openapi/components/schemas/dateTime.yaml create mode 100644 openapi/components/schemas/file.yaml create mode 100644 openapi/components/schemas/generic.yaml create mode 100644 openapi/components/schemas/geometry.yaml create mode 100644 openapi/components/schemas/image.yaml create mode 100644 openapi/components/schemas/integer.yaml create mode 100644 openapi/components/schemas/money.yaml create mode 100644 openapi/components/schemas/number.yaml create mode 100644 openapi/components/schemas/spatial.yaml create mode 100644 openapi/components/schemas/string.yaml create mode 100644 openapi/components/schemas/temporal.yaml create mode 100644 openapi/components/schemas/text.yaml create mode 100644 openapi/components/schemas/time.yaml diff --git a/openapi/components/responses/error400.yaml b/openapi/components/responses/error400.yaml index b25118b..9308202 100644 --- a/openapi/components/responses/error400.yaml +++ b/openapi/components/responses/error400.yaml @@ -6,7 +6,3 @@ content: application/json: schema: $ref: ../schemas/errors.yaml - examples: - - errors: - error: Invalid_client - error_description: Invalid client name diff --git a/openapi/components/responses/error403.yaml b/openapi/components/responses/error403.yaml index 9e3836d..f97c694 100644 --- a/openapi/components/responses/error403.yaml +++ b/openapi/components/responses/error403.yaml @@ -6,12 +6,3 @@ content: application/json: schema: $ref: ../schemas/errors.yaml - examples: - - errors: - - items: - code: InsufficientPermission - context: - scope: auth_clients - message: You need to have 'auth_clients' in order to access this API endpoint. - template: You need to have {scope!r} in order to access this API endpoint. - type: system diff --git a/openapi/components/responses/error404.yaml b/openapi/components/responses/error404.yaml index 4d3f51a..6f2d006 100644 --- a/openapi/components/responses/error404.yaml +++ b/openapi/components/responses/error404.yaml @@ -6,7 +6,3 @@ content: application/json: schema: $ref: ../schemas/errors.yaml - examples: - - errors: - error: ItemDoesNotExist - error_description: Resource 'c9b40700-ddbf-48d9-b747-d1f90a37e32c' not found. diff --git a/openapi/components/schemas/URI.yaml b/openapi/components/schemas/URI.yaml new file mode 100644 index 0000000..8b8c238 --- /dev/null +++ b/openapi/components/schemas/URI.yaml @@ -0,0 +1,2 @@ +description: Uniform Resource Identifier. Used to provide an identifier of an external resource, in an RDF data model it is subject indentifier. +type: string \ No newline at end of file diff --git a/openapi/components/schemas/URL.yaml b/openapi/components/schemas/URL.yaml new file mode 100644 index 0000000..34239d7 --- /dev/null +++ b/openapi/components/schemas/URL.yaml @@ -0,0 +1,2 @@ +description: Uniform Resource Locator. Used to provide links to external sources. +type: string \ No newline at end of file diff --git a/openapi/components/schemas/absent.yaml b/openapi/components/schemas/absent.yaml new file mode 100644 index 0000000..b3ca2a3 --- /dev/null +++ b/openapi/components/schemas/absent.yaml @@ -0,0 +1,7 @@ +description: For objects that have been deleted during change, `type` value is changed to `absent` +type: object +properties: + type: + type: string + enum: + - absent \ No newline at end of file diff --git a/openapi/components/schemas/array.yaml b/openapi/components/schemas/array.yaml new file mode 100644 index 0000000..ab47d33 --- /dev/null +++ b/openapi/components/schemas/array.yaml @@ -0,0 +1,2 @@ +description: Array of data. It is recommended to avoid this type and instead use `backref` +type: array \ No newline at end of file diff --git a/openapi/components/schemas/backref.yaml b/openapi/components/schemas/backref.yaml new file mode 100644 index 0000000..9dd1b06 --- /dev/null +++ b/openapi/components/schemas/backref.yaml @@ -0,0 +1,3 @@ +description: Backwards link showing that another model has a link to this one. This item does not hold any data +type: string +enum: \ No newline at end of file diff --git a/openapi/components/schemas/binary.yaml b/openapi/components/schemas/binary.yaml new file mode 100644 index 0000000..9f98c71 --- /dev/null +++ b/openapi/components/schemas/binary.yaml @@ -0,0 +1,3 @@ +description: Binary string of data. A single set should not exceed 1G +type: string +patternProerties: "[0-1]+" \ No newline at end of file diff --git a/openapi/components/schemas/boolean.yaml b/openapi/components/schemas/boolean.yaml new file mode 100644 index 0000000..9b526f6 --- /dev/null +++ b/openapi/components/schemas/boolean.yaml @@ -0,0 +1,10 @@ +description: Logical value of true or false, depending on maturity level this value can be expressed in a non standard true/false values if maturity level is lower than 3 +oneOf: + - type: string + description: Maturity level < 3 + examples: + - true + - 1 + - taip + - type: boolean + description: Maturity level >= 3 \ No newline at end of file diff --git a/openapi/components/schemas/date.yaml b/openapi/components/schemas/date.yaml new file mode 100644 index 0000000..287ae72 --- /dev/null +++ b/openapi/components/schemas/date.yaml @@ -0,0 +1,13 @@ +description: | + Date provided in a standard format based on [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) + + Minimum value: `0001-01-01` + Maximum value: `999-12-31` + + If the resoliution of data is lower than a day or a month 01 can be used instead. + + Based on maturity level data can be: + - maturity level 1 - provided in diffent formats or free text + - maturity level 2 - not according to standard but all in the same format. Or different parts of data are avalable in different fields (eg. year in one field and a month in another) + - maturity level >=3 - data provided according to `ISO 8601` standard +type: string \ No newline at end of file diff --git a/openapi/components/schemas/dateTime.yaml b/openapi/components/schemas/dateTime.yaml new file mode 100644 index 0000000..d81d7f7 --- /dev/null +++ b/openapi/components/schemas/dateTime.yaml @@ -0,0 +1,11 @@ +description: | + Date and time provided in a standard format based on [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) + + Minimum value: `0001-01-01T00:00:00` + Maximum value: `999-12-31T23:59:59.999999` + + Based on maturity level data can be: + - maturity level 1 - provided in diffent formats or free text + - maturity level 2 - not according to standard but all in the same format. Or different parts of data are avalable in different fields (eg. year in one field and a month in another) + - maturity level >=3 - data provided according to `ISO 8601` standard +type: string \ No newline at end of file diff --git a/openapi/components/schemas/error.yaml b/openapi/components/schemas/error.yaml index e25af45..220cb15 100644 --- a/openapi/components/schemas/error.yaml +++ b/openapi/components/schemas/error.yaml @@ -2,7 +2,7 @@ type: object description: | In addition to usual HTTP error codes, additional error information available from the processing system is passed to the client. - This would include a more detailed overview of the internal, business logic or request processing errors that have occurred. + This should include a more detailed overview of the internal, business logic or request processing errors that have occurred. More complex errors can further expand this structure. properties: @@ -14,21 +14,47 @@ properties: - model - property code: - type: string - pattern: ^[A-Z]([A-Z]?[a-z0-9]+)*$ - examples: - - NotImplementedError - - TypeError + description: Each code corresponds to template text for that code + type: integer + enum: + - 400 + - 401 + - 403 + - 404 + - 409 + - 500 + - 503 template: + description: Corresponds to HTTP code type: string + enum: + - Bad Request + - Unauthorised + - Forbidden + - Not Found + - Conflict + - Internal Server Error + - Service Unavalable message: + description: | + Message within the error object contains a more detailed description of the server errors. + These should include more detailed overview of the internal, business logic or request processing errors that have occurred. + + For example: + - "Could not find signature for and: " + - "Cannot use .astype to convert from timezone-aware dtype to timezone-naive dtype. Use obj.tz_localize(None) or obj.tz_convert('UTC').tz_localize(None) instead." + - "Property {property!r} not found" + - "Given value {value} is not defined in enum." + - "New item has revision already set" + - "You do not have permission to push this property." type: string examples: - - 'Could not find signature for and: ' - - >- - Cannot use .astype to convert from timezone-aware dtype to - timezone-naive dtype. Use obj.tz_localize(None) or - obj.tz_convert('UTC').tz_localize(None) instead. + - "Could not find signature for and: " + - "Cannot use .astype to convert from timezone-aware dtype to timezone-naive dtype. Use obj.tz_localize(None) or obj.tz_convert('UTC').tz_localize(None) instead." + - "Property {property!r} not found" + - "Given value {value} is not defined in enum." + - "New item has revision already set" + - "You do not have permission to push this property." context: type: object properties: @@ -40,4 +66,4 @@ properties: $ref: ./property.yaml id: $ref: ./id.yaml - additionalProperties: true + additionalProperties: true \ No newline at end of file diff --git a/openapi/components/schemas/file.yaml b/openapi/components/schemas/file.yaml new file mode 100644 index 0000000..e082040 --- /dev/null +++ b/openapi/components/schemas/file.yaml @@ -0,0 +1,14 @@ +type: object +properties: + id: + description: File unique identifier. During storage this will become an indetifier for the file. + type: string + format: UUID + name: + type: string + type: + description: A [Media type](https://en.wikipedia.org/wiki/Media_type) of the file. + type: string + size: + description: File size in bytes. + type: integer \ No newline at end of file diff --git a/openapi/components/schemas/generic.yaml b/openapi/components/schemas/generic.yaml new file mode 100644 index 0000000..7812718 --- /dev/null +++ b/openapi/components/schemas/generic.yaml @@ -0,0 +1,10 @@ +description: Dynamic relationship with a model. Used when there is a need to reflect a dynamic link to another model - not only via id, but also via it's name. Using this, one element can be linked to multiple models. +type: object +properties: + object_model: + description: Full name of a linked model + type: string + object_id: + description: Linked model ID + type: string + format: UUID \ No newline at end of file diff --git a/openapi/components/schemas/geometry.yaml b/openapi/components/schemas/geometry.yaml new file mode 100644 index 0000000..194b2c5 --- /dev/null +++ b/openapi/components/schemas/geometry.yaml @@ -0,0 +1,83 @@ +description: | + Geometry data. Data provided in [WKT](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) format, using [EPSG](https://epsg.org/home.html) database parameters, for different projections. + It can be presented as: + - geometry(form, crs) - providing form and coordinate system + - geometry(crs) - providing coordinate system only + - geometry(form) - providing form only + - geometry - no arguments. + + Depending on maturity level: + - Level 1 - Coordinate system is not defined and data is provided in different coordinate systems. Mixed axes, for example some data is provided as `x, y`, other as `y, x`. Mixed measurements, for example some data is in meters, other in degrees. Adress is provided without coordinates. + - Level 2 - Coordinate system is not defined, but all data is provided according to a single coordinate system. + - Level 3 - Data accuracy in meters element `property.ref` is not provided. + +oneOf: + - type: object + properties: + form: + description: Geometry form can have these types - `point`, `linestring`, `polygon`, `multipoint`, `multilinestring`, `multipolygon`. Each of these types can have `z` (height), `m` (selected measurement like time, distance, width, etc.) or `zm` (height and a selected measurement) designations after the type. + type: string + enum: + - point + - point z + - point m + - point zm + - linestring + - linestring z + - linestring m + - linestring zm + - polygon + - polygon z + - polygon m + - polygon zm + - multipoint + - multipoint z + - multipoint m + - multipoint zm + - multilinestring + - multilinestring z + - multilinestring m + - multilinestring zm + - multipolygon + - multipolygon z + - multipolygon m + - multipolygon zm + crs: + description: A [SRID](https://en.wikipedia.org/wiki/Spatial_reference_system#Identifier) number, which is and identification number of a coordinate system in [EPSG](https://epsg.org/home.html) database. If the number is not provided, it is assumed that data corresponds to `4326` ( [WGS84](https://epsg.io/4326) ) + type: integer + - type: object + properties: + form: + description: Geometry form can have these types - `point`, `linestring`, `polygon`, `multipoint`, `multilinestring`, `multipolygon`. Each of these types can have `z` (height), `m` (selected measurement like time, distance, width, etc.) or `zm` (height and a selected measurement) designations after the type. + type: string + enum: + - point + - point z + - point m + - point zm + - linestring + - linestring z + - linestring m + - linestring zm + - polygon + - polygon z + - polygon m + - polygon zm + - multipoint + - multipoint z + - multipoint m + - multipoint zm + - multilinestring + - multilinestring z + - multilinestring m + - multilinestring zm + - multipolygon + - multipolygon z + - multipolygon m + - multipolygon zm + - type: object + properties: + crs: + description: A [SRID](https://en.wikipedia.org/wiki/Spatial_reference_system#Identifier) number, which is and identification number of a coordinate system in [EPSG](https://epsg.org/home.html) database. If the number is not provided, it is assumed that data corresponds to `4326` ( [WGS84](https://epsg.io/4326) ) + type: integer + - type: string \ No newline at end of file diff --git a/openapi/components/schemas/image.yaml b/openapi/components/schemas/image.yaml new file mode 100644 index 0000000..f272891 --- /dev/null +++ b/openapi/components/schemas/image.yaml @@ -0,0 +1,3 @@ +image: +description: Image file with a same structure as file. +$ref: ./file.yaml \ No newline at end of file diff --git a/openapi/components/schemas/integer.yaml b/openapi/components/schemas/integer.yaml new file mode 100644 index 0000000..a478a9b --- /dev/null +++ b/openapi/components/schemas/integer.yaml @@ -0,0 +1,4 @@ +description: A value of a whole number +type: integer +minimum: -2147483648 +maximum: 2147483647 \ No newline at end of file diff --git a/openapi/components/schemas/money.yaml b/openapi/components/schemas/money.yaml new file mode 100644 index 0000000..702bf2e --- /dev/null +++ b/openapi/components/schemas/money.yaml @@ -0,0 +1,2 @@ +description: The amount of a certain currency. Currency code is provided in `property.ref` in accordance to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). +type: number \ No newline at end of file diff --git a/openapi/components/schemas/number.yaml b/openapi/components/schemas/number.yaml new file mode 100644 index 0000000..527d760 --- /dev/null +++ b/openapi/components/schemas/number.yaml @@ -0,0 +1,2 @@ +description: A value of a real number, based on Floating-Point Arithmetic (IEEE 754), with a decimal point marked with `.`. Whole number can be up to 6 characters in lengh. +type: number \ No newline at end of file diff --git a/openapi/components/schemas/object.yaml b/openapi/components/schemas/object.yaml index 9d9959c..793e911 100644 --- a/openapi/components/schemas/object.yaml +++ b/openapi/components/schemas/object.yaml @@ -46,9 +46,29 @@ properties: patternProperties: ^[a-z](_?[a-z0-9]+)*$: oneOf: - - {} - - allOf: - - $ref: ./ref.yaml + - $ref: ./absent.yaml + - $ref: ./boolean.yaml + - $ref: ./integer.yaml + - $ref: ./number.yaml + - $ref: ./binary.yaml + - $ref: ./string.yaml + - $ref: ./text.yaml + - $ref: ./dateTime.yaml + - $ref: ./date.yaml + - $ref: ./time.yaml + - $ref: ./temporal.yaml + - $ref: ./geometry.yaml + - $ref: ./spatial.yaml + - $ref: ./money.yaml + - $ref: ./file.yaml + - $ref: ./image.yaml + - $ref: ./generic.yaml + - $ref: ./ref.yaml + - $ref: ./backref.yaml + - $ref: ./array.yaml + - $ref: ./URL.yaml + - $ref: ./URI.yaml + # - $ref: ./object.yaml additionalProperties: false description: | Object represents a single row in a table. diff --git a/openapi/components/schemas/ref.yaml b/openapi/components/schemas/ref.yaml index 276e597..2e82527 100644 --- a/openapi/components/schemas/ref.yaml +++ b/openapi/components/schemas/ref.yaml @@ -1,7 +1,15 @@ -type: object -properties: - _type: - type: string - _id: - type: string - format: uuidv4 +description: Reference to an entry in another table +oneOf: + - type: object + description: maturity level > 3 + properties: + _type: + type: string + _id: + type: string + format: uuidv4 + - type: object + description: maturity level >= 3 + properties: + _type: + type: string diff --git a/openapi/components/schemas/spatial.yaml b/openapi/components/schemas/spatial.yaml new file mode 100644 index 0000000..37d1a84 --- /dev/null +++ b/openapi/components/schemas/spatial.yaml @@ -0,0 +1,2 @@ +description: Spatial definition. Same as `geometry`, but defines spatial definition for the entire model. Only one property in the model can have `spatial` type. +$ref: ./geometry.yaml \ No newline at end of file diff --git a/openapi/components/schemas/string.yaml b/openapi/components/schemas/string.yaml new file mode 100644 index 0000000..ee848da --- /dev/null +++ b/openapi/components/schemas/string.yaml @@ -0,0 +1,2 @@ +description: Non natural language strings of characters. Should be provided based on UTF-8 encoding and should not exceed 1G +type: string \ No newline at end of file diff --git a/openapi/components/schemas/temporal.yaml b/openapi/components/schemas/temporal.yaml new file mode 100644 index 0000000..1b405b7 --- /dev/null +++ b/openapi/components/schemas/temporal.yaml @@ -0,0 +1,2 @@ +description: Temporal definition in time. Same format as `dateTime` +type: string \ No newline at end of file diff --git a/openapi/components/schemas/text.yaml b/openapi/components/schemas/text.yaml new file mode 100644 index 0000000..3f629de --- /dev/null +++ b/openapi/components/schemas/text.yaml @@ -0,0 +1,2 @@ +description: Natural language text. +type: string \ No newline at end of file diff --git a/openapi/components/schemas/time.yaml b/openapi/components/schemas/time.yaml new file mode 100644 index 0000000..2c76017 --- /dev/null +++ b/openapi/components/schemas/time.yaml @@ -0,0 +1,13 @@ +description: | + Time provided in a standard format based on [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) + + Minimum value: `00:00:00` + Maximum value: `23:59:59.999999` + + If the resoliution of data is lower than a second 00 can be used instead. + + Based on maturity level data can be: + - maturity level 1 - provided in diffent formats or free text + - maturity level 2 - not according to standard but all in the same format. Or different parts of data are avalable in different fields (eg. year in one field and a month in another) + - maturity level >=3 - data provided according to `ISO 8601` standard +type: string \ No newline at end of file diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 226fcbd..4522c73 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -32,7 +32,7 @@ info: **Once the system is fully operational, this API, and other APIs based on this specification will be provided by a unified endpoint api.gov.lt.** - version: 0.1.0 + version: 0.2.0 license: name: GDFL url: https://www.gnu.org/licenses/fdl-1.3.html @@ -86,37 +86,69 @@ paths: $ref: paths/service.yaml components: securitySchemes: - # Can be implemented based on the available security settings. Are not limmited to OAuth clientCredentials implementations UAPI_test_auth: - description: Test environment authentication. Provides access based on client credentials. Access is granted to perform actions based on scope selected and access levels assigned to the client credentials + description: | + Test environment authentication. + + Client Credentials flow + Provides access based on client credentials. Used to manage data for your Organisation. Access is granted to perform actions based on scope selected and access levels assigned to the client credentials. + + Authorization Code flow + Provides general access to the data. Data access is managed by client rights and the authorization code. In addition to that, if there are active Smart Contracts associated with the client. type: oauth2 flows: clientCredentials: - authorizationUrl: https://put-test.data.gov.lt tokenUrl: https://auth.gov.lt/auth/token scopes: - write:datasets/gov/myorg/myrole/insert: Insert - write:datasets/gov/myorg/myrole/upsert: Upsert - write:datasets/gov/myorg/myrole/update: Update - write:datasets/gov/myorg/myrole/patch: Patch - write:datasets/gov/myorg/myrole/delete: Delete - write:datasets/gov/myorg/myrole/wipe: Wipe + read:datasets/gov/myorg/@myrole: Read objects in my Org for my Role + write:datasets/gov/myorg/@myrole: Write objects in my Org for my Role + rw:datasets/gov/myorg/@myrole: Read and Write objects in my Org for my Role + write:datasets/gov/myorg/@myrole/:wipe: Wipe objects in my Org for my Role + read:datasets/gov/myorg/: Read objects in my Org + write:datasets/gov/myorg/: Write objects in my Org + rw:datasets/gov/myorg/: Read and Write objects in my Org + write:datasets/gov/myorg/:wipe: Wipe objects in my Org + authorizationCode: + authorizationUrl: https://api.gov.lt/oauth + tokenUrl: https://auth.gov.lt/auth/token + scopes: + read:datasets/gov/:all: Read all objects in raw structures + read:onthology/:all: Read all objects + read:onthology/myContract/: Read all data based on active Smart Contracts + UAPI_prod_auth: - description: Provides access based on client credentials. Access is granted to perform actions based on scope selected and access levels assigned to the client credentials + description: | + Can be implemented based on the available security settings. Are not limmited to OAuth clientCredentials or authorizationCode implementations. But when API is provided via api.gov.lt gateway, clientCredentials and authorizationCode are preffered method. This functionality will be provided in a tandem with auth.gov.lt server, which will control the authentication. API agent (or equivalent functional component of the implemented API) will receive and double check the tokens (with auth.gov.lt server) and will control the row and operation level authorisation of data access. + + Client Credentials flow + Provides access based on client credentials. Used to manage data for your Organisation. Access is granted to perform actions based on scope selected and access levels assigned to the client credentials. + + Authorization Code flow + Provides general access to the data. Data access is managed by client rights and the authorization code. In addition to that, if there are active Smart Contracts associated with the client. + **Scope elements** + - read: - provides access to perform `getOne`, `getAll`, `getChanges` `getFile`. + - write: - privides access to perform `insertAll`, `insertOne`, `upsertOne`, `updateOne`, `patchOne`, `deleteOne` + - write:{}/:wipe - privides access to perform `wipeOne` + - myorg - represents the organisation client is assigned to in the metadata catalogue + - myrole - represents the role client is assigned in the metadata catalogue type: oauth2 flows: clientCredentials: - authorizationUrl: https://put.data.gov.lt tokenUrl: https://auth.gov.lt/auth/token scopes: - write:datasets/gov/myorg/insert: Insert - write:datasets/gov/myorg/upsert: Upsert - write:datasets/gov/myorg/update: Update - write:datasets/gov/myorg/patch: Patch - write:datasets/gov/myorg/delete: Delete - write:datasets/gov/myorg/wipe: Wipe - UAPI_example_apiKey: - type: apiKey - name: api_key - in: header + read:datasets/gov/myorg/@myrole: Read objects in my Org for my Role + write:datasets/gov/myorg/@myrole: Write objects in my Org for my Role + rw:datasets/gov/myorg/@myrole: Read and Write objects in my Org for my Role + write:datasets/gov/myorg/@myrole/:wipe: Wipe objects in my Org for my Role + read:datasets/gov/myorg/: Read objects in my Org + write:datasets/gov/myorg/: Write objects in my Org + rw:datasets/gov/myorg/: Read and Write objects in my Org + write:datasets/gov/myorg/:wipe: Wipe objects in my Org + authorizationCode: + authorizationUrl: https://api.gov.lt/oauth + tokenUrl: https://auth.gov.lt/auth/token + scopes: + read:datasets/gov/:all: Read all objects in raw structures + read:onthology/:all: Read all objects + read:onthology/myContract/: Read all data based on active Smart Contracts diff --git a/openapi/paths/file.yaml b/openapi/paths/file.yaml index 515a88f..b982f15 100644 --- a/openapi/paths/file.yaml +++ b/openapi/paths/file.yaml @@ -15,7 +15,22 @@ get: tags: - object security: - - {} + - UAPI_test_auth: + - read:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole + - read:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ + - read:datasets/gov/:all + - read:onthology/:all + - read:onthology/myContract/ + - UAPI_prod_auth: + - read:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole + - read:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ + - read:datasets/gov/:all + - read:onthology/:all + - read:onthology/myContract/ summary: For a given specific object by {id}, retrieve a {file} from it's structure. description: | Retrieve a specific file from an object structure, where it is available. diff --git a/openapi/paths/model.yaml b/openapi/paths/model.yaml index e3d9097..55aa386 100644 --- a/openapi/paths/model.yaml +++ b/openapi/paths/model.yaml @@ -28,7 +28,22 @@ get: tags: - objects security: - - {} + - UAPI_test_auth: + - read:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole + - read:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ + - read:datasets/gov/:all + - read:onthology/:all + - read:onthology/myContract/ + - UAPI_prod_auth: + - read:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole + - read:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ + - read:datasets/gov/:all + - read:onthology/:all + - read:onthology/myContract/ summary: Get multiple objects. description: | Return list of objects for a given model. @@ -83,9 +98,11 @@ post: - objects security: - UAPI_test_auth: - - write:datasets/gov/myorg/myrole/insert + - write:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole - UAPI_prod_auth: - - write:datasets/gov/myorg/myrole/insert + - write:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ summary: Create a single new object or create, update or delete multiple objects in a single request. description: | ## Operation where one or multiple new objects are created. diff --git a/openapi/paths/object.yaml b/openapi/paths/object.yaml index 0fcbad3..b594672 100644 --- a/openapi/paths/object.yaml +++ b/openapi/paths/object.yaml @@ -12,7 +12,7 @@ parameters: head: tags: - - objects + - object security: - {} summary: Return only headers for the API. @@ -27,7 +27,22 @@ get: tags: - object security: - - {} + - UAPI_test_auth: + - read:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole + - read:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ + - read:datasets/gov/:all + - read:onthology/:all + - read:onthology/myContract/ + - UAPI_prod_auth: + - read:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole + - read:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ + - read:datasets/gov/:all + - read:onthology/:all + - read:onthology/myContract/ summary: Get a single object by given {id}. description: | Retrieve a single specific object based on it's unique object identifier {id} @@ -81,9 +96,11 @@ post: - object security: - UAPI_test_auth: - - write:datasets/gov/myorg/myrole/upsert + - write:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole - UAPI_prod_auth: - - write:datasets/gov/myorg/myrole/upsert + - write:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ summary: Upsert an object by {id}. This operation can only be performed on fields that can be indexed. description: | This performs an `Upsert` action. First it checks if there is an existing object based on `{id}`, if there is, it performs `Patch` action, if there isn't it performs `Update` @@ -120,9 +137,11 @@ put: - object security: - UAPI_test_auth: - - write:datasets/gov/myorg/myrole/update + - write:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole - UAPI_prod_auth: - - write:datasets/gov/myorg/myrole/update + - write:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ summary: Update a single object by {id}. description: | Overwrite whole object. Property values, that are not given in request @@ -165,9 +184,11 @@ patch: - object security: - UAPI_test_auth: - - write:datasets/gov/myorg/myrole/patch + - write:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole - UAPI_prod_auth: - - write:datasets/gov/myorg/myrole/patch + - write:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ summary: Patch a single object. description: | Partial object update, only property values given in request body will @@ -209,9 +230,11 @@ delete: - object security: - UAPI_test_auth: - - write:datasets/gov/myorg/myrole/delete + - write:datasets/gov/myorg/@myrole + - rw:datasets/gov/myorg/@myrole - UAPI_prod_auth: - - write:datasets/gov/myorg/myrole/delete + - write:datasets/gov/myorg/ + - rw:datasets/gov/myorg/ summary: Delete a single object by {id} description: | Delete object. This is a soft delete operation, object should not be diff --git a/openapi/paths/wipe.yaml b/openapi/paths/wipe.yaml index 9525b54..6573c24 100644 --- a/openapi/paths/wipe.yaml +++ b/openapi/paths/wipe.yaml @@ -11,9 +11,9 @@ delete: - object security: - UAPI_test_auth: - - write:datasets/gov/myorg/myrole/wipe + - write:datasets/gov/myorg/:wipe - UAPI_prod_auth: - - write:datasets/gov/myorg/myrole/wipe + - write:datasets/gov/myorg/:wipe summary: Hard delete a single object by {id} description: > ## To be used by exception only