Skip to content

Updated resources to include types in path#106

Merged
jeroenrinzema merged 1 commit intomainfrom
fix/datapaths-types
Dec 18, 2025
Merged

Updated resources to include types in path#106
jeroenrinzema merged 1 commit intomainfrom
fix/datapaths-types

Conversation

@jeroenrinzema
Copy link
Copy Markdown
Contributor

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

  • Changed the event and user schema representation from separate paths and types arrays to a single schema array, where each item includes a path and a list of types. This affects the API models (EventWithSchema, SchemaPath) and their usage in the controllers and tests. [1] [2] [3] [4] [5] [6]
  • Updated the OpenAPI YAML specification to reflect the new schema structure, including the SchemaPath definition and required fields. [1] [2]

Database Query and Model Changes

  • Refactored database queries and models for events and users to aggregate types per path, allowing each field to have multiple types. This includes changes to the SQL queries and Go structs in events.go and users.go. [1] [2] [3]

Test Coverage

  • Updated and expanded tests for events and user schemas to validate the new schema structure and support for multiple types per path, including new test cases for fields with multiple types. [1] [2] [3] [4]

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.

@jeroenrinzema jeroenrinzema self-assigned this Dec 18, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 SchemaPath objects 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

@jeroenrinzema jeroenrinzema merged commit 41fd86b into main Dec 18, 2025
4 checks passed
@jeroenrinzema jeroenrinzema deleted the fix/datapaths-types branch December 18, 2025 22:29
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.

2 participants