Skip to content

serialize the location id as id in url body#14273

Merged
valentijnscholten merged 1 commit intoDefectDojo:bugfixfrom
dogboat:locations-abstractedlocationserializer-id
Feb 10, 2026
Merged

serialize the location id as id in url body#14273
valentijnscholten merged 1 commit intoDefectDojo:bugfixfrom
dogboat:locations-abstractedlocationserializer-id

Conversation

@dogboat
Copy link
Contributor

@dogboat dogboat commented Feb 9, 2026

This PR updates AbstractedLocationSerializer to return the the ID of the Location object rather than the object itself (e.g., the URL).

URLs have a 1-1 with Location; the ID of the Location is used when accessing individual URLs via the API (/url) to keep consistency with the quick-lookup /location API endpoint. However, the body of the /url endpoint returns the ID of the URL object itself in the .id attribute, and the ID of the Location object in a .location field. This is a little weird (sorry!), since we never use the URL's ID anywhere else from a user's perspective and I'm sure it'll give someone an unnecessary headache down the road.

Thus, this PR updates the AbstractedLocationSerializer to return the Location's ID under the .id attribute; similarly, URLSerializer is updated to exclude the .location attribute as it's now redundant. At the same time, I've excluded the .hash field; it's used internally for uniqueness checks, there's no real reason to return it at this time.

Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

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

Approved

@Maffooch Maffooch added this to the 2.55.3 milestone Feb 10, 2026
@valentijnscholten
Copy link
Member

@Maffooch @dogboat If this needs to be in 2.55.3 can you rebase against bugfix?

…ctedlocationserializer, exclude hash field in urlserializer
@dogboat dogboat force-pushed the locations-abstractedlocationserializer-id branch from 1549575 to b5a960b Compare February 10, 2026 17:32
@dogboat dogboat changed the base branch from dev to bugfix February 10, 2026 17:32
@dogboat
Copy link
Contributor Author

dogboat commented Feb 10, 2026

@Maffooch @dogboat If this needs to be in 2.55.3 can you rebase against bugfix?

Done!

@valentijnscholten valentijnscholten merged commit 0b830aa into DefectDojo:bugfix Feb 10, 2026
149 checks passed
@dogboat dogboat deleted the locations-abstractedlocationserializer-id branch February 10, 2026 18:22
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.

6 participants