Skip to content
Closed
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
196 changes: 162 additions & 34 deletions core/src/main/resources/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,68 @@ paths:
type: array
items:
$ref: "#/components/schemas/CountryContext"
/api/v1/locations/{parentId}/{locale}:
/api/v1/locations/{language}/address/{address}:
get:
description: Get a location by an address
operationId: getLocationByAddress
tags:
[ Location ]
parameters:
- name: language
in: path
required: true
schema:
type: string
- name: address
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
text/plain:
schema:
$ref: "#/components/schemas/Location"
application/json:
schema:
$ref: "#/components/schemas/Location"
text/json:
schema:
$ref: "#/components/schemas/Location"
/api/v1/locations/{language}/countries:
get:
description: Get a list of all countries, in a certain language
operationId: getCountries
tags:
[ Location ]
parameters:
- name: language
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
text/plain:
schema:
type: array
items:
type: string
applications/json:
schema:
type: array
items:
type: string
text/json:
schema:
type: array
items:
type: string
/api/v1/locations/chidren/{parentId}/{locale}:
get:
description: Get the children of a parent location, in a certain locale
operationId: getCivicChild
Expand Down Expand Up @@ -1128,39 +1189,100 @@ components:
additionalProperties: false
Location:
type: object
properties: { latitude: { type: number, format: double },
longitude: { type: number, format: double } }
additionalProperties: false
LocationWithRadius:
type: object,
description: "Representation of a real-world location"
properties:
mapId: { type: string, nullable: true }
fullDisplayAddress: { type: string, nullable: true }
address: { type: string, nullable: true }
suite: { type: string, nullable: true }
city: { type: string, nullable: true }
civicCityId: { type: string, format: uuid, nullable: true }
neighborhood: { type: string, nullable: true }
county: { type: string, nullable: true }
state: { type: string, nullable: true }
postal: { type: string, nullable: true }
country: { type: string, nullable: true }
countryCode: { type: string, nullable: true }
missionId: { type: string, nullable: true }
ccId: { type: string, nullable: true }
stakeId: { type: string, nullable: true }
areaId: { type: string, nullable: true }
latitude: { type: number, format: double }
longitude: { type: number, format: double }
maxLatitude: { type: number, format: double }
minLatitude: { type: number, format: double }
maxLongitude: { type: number, format: double }
minLongitude: { type: number, format: double }
geoCodeOverride: { type: boolean }
timezone: { type: string, nullable: true }
radiusType: { $ref: '#/components/schemas/DistanceType' }
countryCode2Char: { type: string, nullable: true }
mapId:
type: string
nullable: true
fullDisplayAddress:
description: "Full representation of this location's address"
type: string
nullable: true
address:
description: "Primary street address"
type: string
nullable: true
suite:
description: "Additional address details"
type: string
nullable: true
city:
type: string
nullable: true
civicCityId:
type: string
format: uuid
nullable: true
neighborhood:
type: string
nullable: true
county:
type: string
nullable: true
state:
type: string
nullable: true
postal:
type: string
nullable: true
country:
type: string
nullable: true
countryCode:
description: "ISO 3166-1 standard three-letter country code"
type: string
nullable: true
locationVisibilityId:
type: integer
format: int32
missionId:
type: string
nullable: true
ccId:
type: string
nullable: true
stakeId:
type: string
nullable: true
areaId:
type: string
nullable: true
latitude:
type: number
format: double
longitude:
type: number
format: double
maxLatitude:
type: number
format: double
minLatitude:
type: number
format: double
maxLongitude:
type: number
format: double
minLongitude:
type: number
format: double
geoCodeOverride:
type: boolean
timezone:
type: string
nullable: true
additionalProperties: false
LocationWithRadius:
description: "Representation of an area in the vicinity of a real-world location"
allOf:
- $ref: '#/components/schemas/Location'
- type: object
properties:
radiusType: { $ref: '#/components/schemas/DistanceType' }
countryCode2Char:
description: "ISO 3166-1 standard two-letter country code"
type: string
nullable: true
additionalProperties: false
VolunteerCenterInfo:
type: object
properties:
Expand Down Expand Up @@ -2040,8 +2162,9 @@ components:
format: uuid
logo:
type: string
CountryInfo:
CountryBasicIdentifiers:
type: object
description: "Basic standardized identifiers for a country."
properties:
twoCharCode:
type: string
Expand All @@ -2060,14 +2183,19 @@ components:
type: object
properties:
countryInfo:
$ref: "#/components/schemas/CountryInfo"
allOf:
- $ref: "#/components/schemas/CountryBasicIdentifiers"
description: "Basic standardized identifiers for a country. Should be named countryBasicIdentifiers to avoid confusion, but maintain JSON property 'countryInfo'"
country:
description: "Name of the country"
type: string
nullable: true
state:
description: "A principal subdivision of a country"
type: string
nullable: true
county:
description: "A smaller subdivision of a state"
type: string
nullable: true
LocaleNames:
Expand Down
25 changes: 25 additions & 0 deletions core/src/test/groovy/org/justserve/LocationSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,29 @@ class LocationSpec extends JustServeSpec {
[[client, userType], lang] << [[[noAuthLocationClient, "no auth"], [locationClient, "standard"]], threeCharLocales].combinations()
}

@SuppressWarnings("GroovyAssignabilityCheck")
@Unroll("Can query LocationClient.getCountries(#lang) with no error as #userType")
def "can query countries with by a given language"(LocationClient client, String userType, String lang){
when:
client.getCountries(lang).block()

then:
noExceptionThrown()

where:
[[client, userType], lang] << [[[noAuthLocationClient, "no auth"], [locationClient, "standard"]], threeCharLocales].combinations()
}

@SuppressWarnings("GroovyAssignabilityCheck")
@Unroll("Can query LocationClient.getLocationByAddress(#lang, address) for a known working location with no error as #userType")
def "can query location by address for a given language"(LocationClient client, String userType, String lang){
when:
client.getLocationByAddress(lang, knownWorkingLocation).block()

then:
noExceptionThrown()

where:
[[client, userType], lang] << [[[noAuthLocationClient, "no auth"], [locationClient, "standard"]], threeCharLocales].combinations()
}
}
Loading