{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eckari-com/json-schema/eckari-com-weather-us-forecast-output-schema.json",
  "title": "weather_us_forecast_output",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eckari-com-weather-api-openapi.yml#/components/schemas/weather_us_forecast_output",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "query",
    "location",
    "updated_at",
    "generated_at",
    "valid_from",
    "periods"
  ],
  "properties": {
    "query": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "lat",
        "lon",
        "hourly",
        "period_limit",
        "hours",
        "detail"
      ],
      "description": "The request as resolved, echoed so a batched caller can match answers to inputs and see which defaults were applied.",
      "properties": {
        "lat": {
          "type": "number",
          "description": "Latitude actually queried (rounded to 4 decimal places)."
        },
        "lon": {
          "type": "number",
          "description": "Longitude actually queried (rounded to 4 decimal places)."
        },
        "hourly": {
          "type": "boolean",
          "description": "True when the hourly series was requested."
        },
        "period_limit": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Maximum number of 12-hour day/night periods requested (default 6); null when hourly is true. The forecast office may issue fewer, so this is the ceiling, not periods.length."
        },
        "hours": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Number of hourly periods requested (default 24); null when hourly is false."
        },
        "detail": {
          "type": "string",
          "description": "Detail level applied - compact (default) or full."
        }
      }
    },
    "location": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "city",
        "state",
        "timezone"
      ],
      "description": "What the National Weather Service reports at the queried point. The coordinates are in query; the forecast office and grid square that produced the forecast are provenance, not weather, and are not published here - meta.source names the provider.",
      "properties": {
        "city": {
          "type": [
            "string",
            "null"
          ],
          "description": "Nearest named place reported by NWS for the point; null when NWS omits it."
        },
        "state": {
          "type": [
            "string",
            "null"
          ],
          "description": "Two-letter US state or territory code."
        },
        "timezone": {
          "type": [
            "string",
            "null"
          ],
          "description": "IANA timezone of the point as reported by NWS - the zone the period start_time and end_time offsets are expressed in."
        }
      }
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "Time the forecast product was issued by the forecast office (NWS updateTime), RFC 3339 UTC. This is the true age of the forecast."
    },
    "generated_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "Time NWS generated this response from the forecast grid (RFC 3339 UTC)."
    },
    "valid_from": {
      "type": [
        "string",
        "null"
      ],
      "description": "Start of the validity interval of the underlying forecast grid (RFC 3339 UTC)."
    },
    "periods": {
      "type": "array",
      "description": "Forecast periods in chronological order, soonest first, as issued by the forecast office. This is a time series, not a paged list - ask for more with periods or hours.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "start_time",
          "end_time",
          "is_daytime",
          "temperature_c",
          "temperature_f",
          "precipitation_probability_pct",
          "wind_speed_range_kmh",
          "wind_direction",
          "short_forecast"
        ],
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Period label such as Tonight or Tuesday; null for hourly periods."
          },
          "start_time": {
            "type": "string",
            "description": "Period start as RFC 3339 with the local UTC offset NWS issues (for example 2026-08-18T08:00:00-04:00), always in that one format. A forecast period is a local-time concept, so the offset is kept rather than converted to UTC."
          },
          "end_time": {
            "type": "string",
            "description": "Period end, same format as start_time."
          },
          "is_daytime": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "True when the National Weather Service marks the period as daytime, false when it marks it as night, null when the forecast omits the flag - null is not night."
          },
          "temperature_c": {
            "type": [
              "number",
              "null"
            ],
            "description": "Forecast temperature in degrees Celsius (2 decimal places). Null when NWS omits the value or issues it with a unit this contract does not recognise - a number with no stated unit is never assumed to be Fahrenheit."
          },
          "temperature_f": {
            "type": [
              "number",
              "null"
            ],
            "description": "The same forecast temperature in degrees Fahrenheit - the scale NWS issues for US forecasts. Null under the same conditions as temperature_c."
          },
          "precipitation_probability_pct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Probability of precipitation for the period as a percentage; null when the forecast office does not give one."
          },
          "wind_speed_range_kmh": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "min",
              "max"
            ],
            "description": "Wind speed range in kilometres per hour, parsed from the text phrase NWS issues (\"3 to 7 mph\" gives min 4.83 / max 11.27; \"10 mph\" gives min = max = 16.09). Null when the phrase is not one this contract parses - never a guessed number. A forecast wind is issued as a range, which is why this is an object and why the name says range; the measured wind in weather.us.observation is a single wind_speed_kmh number, so the two are never confused across the family.",
            "properties": {
              "min": {
                "type": "number",
                "description": "Lower bound of the forecast wind speed in km/h (2 decimal places)."
              },
              "max": {
                "type": "number",
                "description": "Upper bound in km/h; equal to min when NWS issues a single speed rather than a range."
              }
            }
          },
          "wind_direction": {
            "type": [
              "string",
              "null"
            ],
            "description": "Compass direction the wind blows FROM, as issued by NWS (for example NW)."
          },
          "short_forecast": {
            "type": [
              "string",
              "null"
            ],
            "description": "Short forecast phrase issued by NWS, for example \"Partly Sunny\"."
          },
          "temperature_trend": {
            "type": [
              "string",
              "null"
            ],
            "description": "NWS trend note such as rising or falling; usually null. Returned only when detail=full."
          },
          "dewpoint_c": {
            "type": [
              "number",
              "null"
            ],
            "description": "Dewpoint in degrees Celsius (2 decimal places). Hourly periods only, and returned only when detail=full."
          },
          "humidity_pct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Relative humidity as a percentage (2 decimal places). Hourly periods only, and returned only when detail=full."
          },
          "detailed_forecast": {
            "type": [
              "string",
              "null"
            ],
            "description": "Detailed narrative issued by NWS; null for hourly periods. Returned only when detail=full - it restates the structured fields in prose."
          },
          "icon": {
            "type": [
              "string",
              "null"
            ],
            "description": "NWS icon URL for the period. Returned only when detail=full."
          }
        }
      }
    }
  }
}