-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GraphQL schema (manual) and add client generation script
- Loading branch information
Showing
6 changed files
with
83 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
# GraphQL | ||
####### | ||
|
||
.PHONY: generate_client | ||
generate_client: ## Generate client for the GraphQL API, from the schema in `schema/` | ||
cd schema && bal graphql -i ./graphql.config.yaml -o ../../client | ||
|
||
|
||
# Util | ||
####### | ||
|
||
.PHONY: help | ||
help: # See: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
query DistrictAndCityByProvince($name: String!) { | ||
geo { | ||
province(name: $name) { | ||
name { | ||
name_en | ||
} | ||
districts { | ||
name { | ||
name_en | ||
} | ||
cities { | ||
name { | ||
name_en | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
schema: "./schema.graphql" | ||
documents: | ||
- "./documents/geo_data.graphql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
type CityData { | ||
name: LocalizedName! | ||
district: DistrictData! | ||
} | ||
|
||
type DistrictData { | ||
name: LocalizedName! | ||
province: ProvinceData! | ||
cities: [CityData!]! | ||
} | ||
|
||
type GeoData { | ||
province(name: String!): ProvinceData! | ||
district(name: String!): DistrictData! | ||
city(name: String!): CityData! | ||
} | ||
|
||
""" | ||
Localized names in English, Sinhala, and Tamil. | ||
Names are stored with a `name_` prefix, followed | ||
by the respective ISO 639-1 language code. | ||
This record requires an English name, `name_en`. | ||
""" | ||
type LocalizedName { | ||
"""Name in English""" | ||
name_en: String! | ||
|
||
"""Name in Tamil, தமிழ்""" | ||
name_ta: String! | ||
|
||
"""Name in Sinhala, සිංහල""" | ||
name_si: String! | ||
} | ||
|
||
type ProvinceData { | ||
name: LocalizedName! | ||
districts: [DistrictData!]! | ||
} | ||
|
||
type Query { | ||
geo: GeoData! | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.