Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved Schemas #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This repository contains materials useful to users of the IRA Rebates API ***bet
## JSON Schema
The `/json_schemas` folder includes JSON Schema files that are used by the IRA Rebate API to validate the JSON payload for each POST endpoint. API users may find these files useful as the most precise documentation regarding the allowed structure of the POST endpoint payloads. The schema files can also be used, together with a json schema validator (see https://json-schema.org/implementations), to validate the POST payloads before submitting to the API. This may be especially helpful during the development of client software.

Additionally, the `/resolved_json_schemas` folder includes JSON Schema payload files where all referenced definitions are resolved. This provides a way to use an online JSON schema validator (see https://www.liquid-technologies.com/online-json-schema-validator) to validate a POST payload.

### API endpoint to JSON Schema table
| API POST endpoint | JSON schema filename |
| ---- | ---- |
Expand All @@ -32,6 +34,7 @@ All other json schema files are referenced from those listed in the table.
- Home Energy Rebate Tools (the high-level web page for the IRA Rebate API and related tools): https://www.pnnl.gov/projects/rebate-tools
- JSON Schema documentation: https://json-schema.org/
- JSON Schema validators: https://json-schema.org/implementations
- JSON Schema online validator: https://www.liquid-technologies.com/online-json-schema-validator

## Feedback and Support
We appreciate feedback from API users. Please email feedback to [email protected].
130 changes: 130 additions & 0 deletions resolved_json_schemas/addressServicePayload.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://ira-rebates.labworks.org/schemas/addressService",
"properties": {
"street_number": {
"type": "string",
"title": "Street number",
"pattern": "^\\d+(?:-\\d+)?$",
"minLength": 1,
"maxLength": 10,
"description": "The building number. This would be “122” for the address: 122 Mayflower Hill Dr, Waterville, ME 04901."
},
"street": {
"type": "string",
"title": "Street",
"minLength": 1,
"description": "The name of the street, avenue, etc.. This would be “Mayflower HIll Dr” for the address: 122 Mayflower Hill Dr, Waterville, ME 04901."
},
"city": {
"type": "string",
"title": "City",
"minLength": 1,
"description": "The name of the city, town, etc.. This would be “Waterville” for the address: 122 Mayflower Hill Dr, Waterville, ME 04901."
},
"state": {
"title": "State",
"$comment": " https://bedes.lbl.gov/bedes-online/state",
"enum": [
"AA",
"AE",
"AK",
"AL",
"AP",
"AR",
"AS",
"AZ",
"CA",
"CO",
"CT",
"DC",
"DE",
"FL",
"FM",
"GA",
"GU",
"HI",
"IA",
"ID",
"IL",
"IN",
"KS",
"KY",
"LA",
"MA",
"MD",
"ME",
"MH",
"MI",
"MN",
"MO",
"MP",
"MS",
"MT",
"NC",
"ND",
"NE",
"NH",
"NJ",
"NM",
"NV",
"NY",
"OH",
"OK",
"OR",
"PA",
"PR",
"PW",
"RI",
"SC",
"SD",
"TN",
"TX",
"UT",
"VA",
"VI",
"VT",
"WA",
"WI",
"WV",
"WY"
],
"description": "The name, or two letter code, for the state. This would be “ME” for the address: 122 Mayflower Hill Dr, Waterville, ME 04901."
},
"zip_code": {
"type": "string",
"title": "Zip code",
"pattern": "^(\\d{5}(-\\d{4})?)$",
"description": "The *zip_code* is the 5-digit or 9-digit zip code. This would be “04901” for the address: 122 Mayflower Hill Dr, Waterville, ME 04901."
},
"county": {
"type": "string",
"title": "County",
"minLength": 1,
"description": "The name of the county containing the address."
}
},
"required": [
"street_number",
"street",
"state"
],
"additionalProperties": false,
"anyOf": [
{
"required": [
"city"
]
},
{
"required": [
"zip_code"
]
},
{
"required": [
"county"
]
}
]
}
Loading