openapi: 3.0.0
info:
  title: Wsdot Weather Stations API
  version: 1.0.0
  description: Wsdot Weather Stations API - Washington State Department of Transportation APIs
servers:
  - url: https://wsdot.wa.gov/traffic/api/WeatherStations/WeatherStationsREST.svc
    description: Production server
components:
  schemas:
    RoadwayLocation:
      type: object
      properties:
        Description:
          type: string
          nullable: true
          description: Human-readable description of the roadway location, such as interchange names or cross streets.
        Direction:
          type: string
          nullable: true
          description: 'Traffic direction designation: N, S, B, NB, or SB, indicating which side of the highway is affected.'
        Latitude:
          type: number
          description: Latitude of the roadway location in decimal degrees.
        Longitude:
          type: number
          description: Longitude of the roadway location in decimal degrees.
        MilePost:
          type: number
          description: Milepost marker along the highway corridor, with 0 indicating route terminus.
        RoadName:
          type: string
          nullable: true
          description: Highway or route designation code, such as '005' for I-5 or '090' for I-90.
      required:
        - Description
        - Direction
        - Latitude
        - Longitude
        - MilePost
        - RoadName
      description: Roadway location information including route, milepost, coordinates, and direction.
  parameters: {}
paths:
  /GetCurrentStationsAsJson:
    get:
      summary: List weather station metadata for all stations statewide.
      operationId: fetchWeatherStations
      tags:
        - weather-stations
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import { fetchWeatherStations } from 'ws-dottie/wsdot-weather-stations/core';

            const data = await fetchWeatherStations({
              fetchMode: 'native',
              validate: true
            });

            console.log(data);
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    Latitude:
                      type: number
                      description: Latitude of the weather station in decimal degrees.
                    Longitude:
                      type: number
                      description: Longitude of the weather station in decimal degrees.
                    StationCode:
                      type: integer
                      description: Numeric ID of the weather station.
                    StationName:
                      type: string
                      nullable: true
                      description: Display name of the weather station.
                  required:
                    - Latitude
                    - Longitude
                    - StationCode
                    - StationName
                  description: Weather station metadata including station identifier, name, and location coordinates for WSDOT Road Weather Information System stations.
              examples:
                sampleResponse:
                  summary: Sample response
                  description: Example of a successful response from the API (showing first item of 131 total)
                  value:
                    - Latitude: 47.4748
                      Longitude: -122.2704
                      StationCode: 1909
                      StationName: S 144th St on SB I-5 at mp 155.32
tags:
  - name: weather-stations
    description: Weather station metadata and location information for WSDOT Road Weather Information System stations statewide.
    x-description: Station identifiers, names, and location coordinates for weather stations that collect atmospheric and pavement condition data.
    x-cacheStrategy: FREQUENT
    x-useCases:
      - Discover weather stations by location for weather data queries.
      - Identify station identifiers and names for weather data lookups.
      - Support location-based weather station searches.
    x-updateFrequency: daily
