USACE / USACE/cwms-data-api

Swagger UI rating-id not attached to query

Open
#1,696 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
28
Forks
25
Avg merge
4d 22h
Merged PRs (30d)
20

Description

Describe the bug
When querying /ratings/rate-values the SwaggerUI does not properly insert the rating-id into the URL

Image

Expected behavior
Expect the rating-id to be placed into the URL and properly URI encoded

To Reproduce

  1. Navigate to swagger,
  2. Click "try it out"
  3. Enter "office" and "rating-id".
  4. Keep body as is just to see rating-id is not passed through
  5. Click execute
  6. Observe the sample URL it shows

Logs/Incident Identifier
I confirmed when querying this that the backend says

{
  "message": "Bad Request.",
  "incidentIdentifier": "16568336-984a-4c6a-a9cd-968d766f5d27",
  "source": "User Input",
  "details": {
    "message": "ORA-20019: INVALID_ITEM: \"{rating-id}\" is not a valid rating specification."
  }
}

Suggesting '{rating-id}' was passed through as an actual rating ID

CURL Commands
I confirmed the rate-values endpoint still works with

fetch(
  "https://cwms-data.usace.army.mil/ratings/rate-values/SWT/KEYS.Opening-Spillway_Gates%2CElev%3BFlow-Spillway_Gates.Standard.Production",
  {
    method: "POST",
    headers: {
      Accept: "application/json",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "output-unit": "cfs",
      round: false,
      values: [[0.5], [725.2499999999999]],
      "input-units": ["ft", "ft"],
      "rating-time": 1776094200000,
      "value-times": [1776094200000],
    }),
  },
)
  .then((r) => r.json())
  .then((d) => console.log(d));

CDA Version (please complete the following information):

  • Version [ 2026.03.06-testa ] on our T7 (SWT)
    I attempted this on Test and Dev but these do not have our ratings (Surprised Test did not have it)

Additional context
Helping @DanielTOsborne figure out why rate-values was not working. Still not sure on that but I thought to report this swagger bug.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the request in Swagger UI for the POST /ratings/rate-values endpoint, using the reported rating ID and comparing its generated URL with the working fetch example. Trace the Swagger/OpenAPI definition for this endpoint and verify that rating-id is substituted and URI encoded rather than sent literally; done means the sample URL contains the encoded rating ID and the request succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.