Updated resources to include types in path#106
Merged
jeroenrinzema merged 1 commit intomainfrom Dec 18, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the event and user schema representation from separate paths and types arrays to a unified schema array where each item contains a path and its associated types. This change enables proper support for fields that may have multiple types across different events or users.
Key changes:
- Updated OpenAPI specification and generated types to use
SchemaPathobjects instead of parallel arrays - Refactored database queries to aggregate multiple types per path using
array_agg(DISTINCT data_type) - Added comprehensive test coverage for multi-type field scenarios
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| services/nexus/internal/store/events.go | Updated Event struct and ListEvents query to group types by path, with post-processing to reconstruct event objects |
| services/nexus/internal/store/users.go | Changed UserSchema to use Types array and updated query to aggregate distinct types per path |
| services/nexus/internal/http/controllers/v1/management/events.go | Modified controller to map new Schema field structure to API response |
| services/nexus/internal/http/controllers/v1/management/users.go | Updated controller to convert Types array to response format |
| services/nexus/internal/http/controllers/v1/management/oapi/resources.yml | Changed schema definitions from parallel paths/types arrays to nested schema array with SchemaPath objects |
| services/nexus/internal/http/controllers/v1/management/oapi/resources_gen.go | Regenerated types reflecting the new schema structure |
| services/nexus/internal/http/controllers/v1/management/events_test.go | Updated existing tests and added TestListEventsWithMultipleTypes to validate multi-type support |
| services/nexus/internal/http/controllers/v1/management/users_test.go | Updated existing tests and added TestListUserSchemasWithMultipleTypes to validate multi-type support |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how event and user schema paths and their types are represented and queried throughout the codebase. Instead of storing event/user schema as separate arrays of paths and types, schemas are now modeled as arrays of objects, each containing a path and all associated types. This change improves support for fields that may have multiple types and aligns the API, tests, and database queries with the new structure.
Event and User Schema Representation
pathsandtypesarrays to a singleschemaarray, where each item includes apathand a list oftypes. This affects the API models (EventWithSchema,SchemaPath) and their usage in the controllers and tests. [1] [2] [3] [4] [5] [6]SchemaPathdefinition and required fields. [1] [2]Database Query and Model Changes
events.goandusers.go. [1] [2] [3]Test Coverage
These changes collectively improve the flexibility and accuracy of schema representation in the API and backend, making it easier to handle real-world scenarios where fields may have different types across events or users.