Skip to content

Conversation

@zack-rma
Copy link
Collaborator

@zack-rma zack-rma commented Sep 16, 2025

Fixes #1036

Adds support for including aliases in location getOne results.

Includes alias formatting fixes for location level DAO and tests.

@rma-rripken
Copy link
Collaborator

I'm curious about LocationAlias switching from the locationLevelId field to categoryId-groupId. How and when are they different, what does that change do?

@zack-rma
Copy link
Collaborator Author

The categoryId-groupId alias field is the correct format, as seen in the example input of the initial issue. It can also been seen here in code: https://github.com/USACE/cwms-data-api/blame/e56603d0de8c393326c1dc089250177c7c44163b/cwms-data-api/src/main/java/cwms/cda/data/dao/LocationsDaoImpl.java#L576.

I mistakenly set this value to the locationId, so this was a fix. I also applied it to my recent alias change for location levels.

Copy link
Contributor

@MikeNeilson MikeNeilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with Ryan. Field should be null and not render if aliases not requested and empty array if requested and no aliases.

Copy link
Contributor

@MikeNeilson MikeNeilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts, but nothing that rises to the level of "we absolutely must make the change."

retVal.setPropertyNamingStrategy(PropertyNamingStrategies.KEBAB_CASE);
retVal.setSerializationInclusion(JsonInclude.Include.NON_NULL);
retVal.registerModule(new JavaTimeModule());
retVal.registerModule(new Jdk8Module());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent, saved by a simple plugin.

if (first.getAliases().isPresent() && second.getAliases().isPresent()) {
assertEquals(first.getAliases().get().size(), second.getAliases().get().size(),
"Alias list sizes do not match");
for (LocationAlias alias : first.getAliases().get()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it matters given these arrays are small but I can't help but think there's a cleaner way to do this.

Though perhaps the Aliases should be a Set, and not even an ordered one, might make the comparison easier, I'm pretty sure we can't have duplicate alias names.

But that doesn't need to happen this PR. and the duplication here make sense as you're providing more specific asserts for diagnostics.

@rma-rripken rma-rripken merged commit 83e0ecd into USACE:develop Sep 18, 2025
8 checks passed
@zack-rma zack-rma deleted the feature/location-aliases branch September 18, 2025 17:01
MikeNeilson pushed a commit that referenced this pull request Oct 23, 2025
Fixes #1036

Adds support for including aliases in location getOne results.

Includes alias formatting fixes for location level DAO and tests.

(cherry picked from commit 83e0ecd)
MikeNeilson pushed a commit that referenced this pull request Oct 24, 2025
Fixes #1036

Adds support for including aliases in location getOne results.

Includes alias formatting fixes for location level DAO and tests.

(cherry picked from commit 83e0ecd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Locations Endpoint - Return Aliases

3 participants