diff --git a/core/src/main/resources/schema.yml b/core/src/main/resources/schema.yml index 69fb5c9..ce70a11 100644 --- a/core/src/main/resources/schema.yml +++ b/core/src/main/resources/schema.yml @@ -84,6 +84,36 @@ paths: type: array items: $ref: "#/components/schemas/CountryContext" + /api/v1/locations/{language}/countries/postal: + get: + description: Get identifiers for all countries + operationId: getAllCountryIdentifiers + tags: [ Location ] + parameters: + - name: language + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + content: + text/plain: + schema: + type: array + items: + $ref: "#/components/schemas/CountryIdentifiers" + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/CountryIdentifiers" + text/json: + schema: + type: array + items: + $ref: "#/components/schemas/CountryIdentifiers" /api/v1/locations/{parentId}/{locale}: get: description: Get the children of a parent location, in a certain locale @@ -2070,6 +2100,24 @@ components: county: type: string nullable: true + CountryIdentifiers: + description: Standardized identifiers for a country. + allOf: + - $ref: "#/components/schemas/CountryInfo" + - type: object + properties: + usePostal: + type: boolean + countryName: + description: name of the country + type: string + nullable: true + countryId: + description: UUID associated with this country + type: string + format: uuid # This restriction is not present in swagger.json, but all returns are of UUID form + nullable: true + additionalProperties: false LocaleNames: type: object properties: diff --git a/core/src/test/groovy/org/justserve/LocationSpec.groovy b/core/src/test/groovy/org/justserve/LocationSpec.groovy index d322c9f..b2c4ef4 100644 --- a/core/src/test/groovy/org/justserve/LocationSpec.groovy +++ b/core/src/test/groovy/org/justserve/LocationSpec.groovy @@ -38,4 +38,17 @@ class LocationSpec extends JustServeSpec { [[client, userType], lang] << [[[noAuthLocationClient, "no auth"], [locationClient, "standard"]], threeCharLocales].combinations() } + @SuppressWarnings("GroovyAssignabilityCheck") + @Unroll("Can query LocationClient.getAllCountryIdentifiers(#lang) with no error as #userType") + def "can query all country identifiers for a given language"(LocationClient client, String userType, String lang) { + when: + client.getAllCountryIdentifiers(lang).block() + + then: + noExceptionThrown() + + where: + [[client, userType], lang] << [[[noAuthLocationClient, "no auth"], [locationClient, "standard"]], threeCharLocales].combinations() + } + }