* Replace swagger-ui-react with openapi-explorer in API Browser
Swap out the heavyweight swagger-ui-react component for the openapi-explorer
web component, removing ~250 lines of custom CSS theming in the process.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Supplying base url to OpenAPI explorer.
* Simplifying passing API prefix.
* Load openapi-explorer asynchronously for code splitting.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Adding styling.
* Adding download link.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Formatting, typing.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Making use of React Compiler for auto-memoization.
* Passing formik context into custom command.
* Adjusting test.
* Migrating parts of webpack config to TS.
* Revert "Migrating parts of webpack config to TS."
This reverts commit 4cd7d933e5.
* Improving type.
* Asserting type.
* Fixing `react-hooks/preserve-manual-memoization` by removing `useMemo`/`useCallback` where applicable.
* Updating lockfile.
* Fixing linter hint.
* Initial plan
* Update react-window and react-window-infinite-loader to v2
- Update react-window from 1.8.2 to 2.2.5
- Update react-window-infinite-loader from 1.0.8 to 2.0.1
- Remove @types/react-window as v2 includes built-in types
- Migrate from FixedSizeList to List API in fields List.tsx
- Migrate from VariableSizeList to List API in CustomMenuList.tsx
- Update InfiniteLoader API in AsyncCustomMenuList.tsx (onItemsRendered -> onRowsRendered)
- Adjust to new v2 prop names: itemCount -> rowCount, itemSize -> rowHeight, children -> rowComponent
- Adjust to new v2 rowComponent pattern with rowProps
- All existing tests pass successfully
Co-authored-by: dennisoelkers <41929+dennisoelkers@users.noreply.github.com>
* Fix totalHeight calculation in CustomMenuList
Improve the totalHeight calculation to properly iterate through children
and use default size for unmeasured items. This addresses a code review
comment about potential incorrect height calculations.
Co-authored-by: dennisoelkers <41929+dennisoelkers@users.noreply.github.com>
* Use useInfiniteLoader hook instead of InfiniteLoader component
Replace InfiniteLoader component with the useInfiniteLoader hook as suggested
by @dennisoelkers. The hook provides a cleaner API and better type safety.
This eliminates the render prop pattern in favor of a direct hook call.
Co-authored-by: dennisoelkers <41929+dennisoelkers@users.noreply.github.com>
* Fix TypeScript type error for fieldList in List.tsx
Add .toList() after sortBy() to convert Iterable back to List type.
This fixes the TS2740 error where Iterable<number, FieldTypeMapping>
was being passed instead of List<FieldTypeMapping>.
Co-authored-by: dennisoelkers <41929+dennisoelkers@users.noreply.github.com>
* Remove `@types/react-window` again.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dennisoelkers <41929+dennisoelkers@users.noreply.github.com>
Co-authored-by: Dennis Oelkers <dennis@graylog.com>
Co-authored-by: Linus Pahl <linus.pahl@graylog.com>
* Initial working state of OpenAPI spec generation
Generates an OpenAPI spec but still has lots of issues
* Fix wrong import
* Add NoAuditEvent annotation to test resource methods
* Add OpenAPI browser frontend (POC)
Add basic OpenAPI browser UI using Redoc loaded from CDN. This is a proof
of concept implementation not yet ready for production use.
- Loads Redoc from CDN to avoid webpack bundling complexity
- Displays OpenAPI spec from /api/openapi.yaml endpoint
- Accessible via Help menu → "OpenAPI browser"
- Route: /openapi-browser
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Make both json & yaml formats work
* Implement plugin path prefixing
+ configure the openAPI context directly to be able to
use dependency injection
* Remove logging
* Migrate REST resources from Swagger to OpenAPI 3.x annotations
Migrated ~150 REST resource files from old Swagger annotations
(io.swagger.annotations.*) to OpenAPI 3.x annotations
(io.swagger.v3.oas.annotations.*).
Migration performed using OpenRewrite and manual fixes:
- @Api → @Tag
- @ApiOperation → @Operation
- @ApiParam → @Parameter
- @ApiResponse code → responseCode
- @ApiResponse message → description
- Removed invalid attributes (allowableValues, defaultValue, tags)
- Fixed nickname → operationId
- Removed response= attribute (needs manual restoration)
Note: Some information was intentionally lost and needs restoration:
- Response type schemas (33 instances)
- Parameter allowableValues constraints (58 instances)
- CLOUD_VISIBLE tags (82 instances)
🤖 Generated with Claude Code (https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Restore response type information to OpenAPI annotations
Adds @ApiResponses with @Content and @Schema to restore the 33 instances
of response type information that were lost during the OpenAPI 3.x migration.
- Automated script restored 20 instances
- Manual additions for 8 instances with multi-line annotations
- 5 instances already fixed in previous commit
- All response codes verified against actual implementation
- Total: 33 response types restored with accurate HTTP status codes
Co-Authored-By: Claude <noreply@anthropic.com>
* Restore parameter allowableValues constraints for OpenAPI 3.x migration
Restore allowableValues constraints that were lost during OpenAPI 3.x
migration by converting from @ApiParam(allowableValues) to
@Parameter with @Schema(allowableValues).
This restores API documentation for parameter value constraints across
22 REST resource files, covering ~58 parameter instances.
Changes:
- Migrated allowableValues from Swagger 2.x @ApiParam to OpenAPI 3.x
@Parameter with @Schema(allowableValues = {...})
- Added missing Schema imports where needed
- Fixed several bugs and inconsistencies from master branch
Summary of Semantic Differences (11 files):
Bug Fixes:
- AuthzRolesResource.getUsersForRole(): Fixed incorrect field list that
had user fields (username,full_name,email) instead of role fields
(id,name,description)
- DatanodeResource: Fixed completely wrong field list (title,description,
type) to actual DataNodeDto fields (hostname,data_node_status,
transport_address,cert_valid_until,datanode_version)
- IndexSetTemplateResource: Fixed "name" to "title" (correct field name)
Added Missing Valid Fields:
- DashboardsResource, SavedSearchesResource, ViewsResource: Added
"last_updated_at" which exists in SEARCH_FIELD_MAPPING
- ViewsResource: Added "owner", "description", "summary" (was very
incomplete in master)
- AuthzRolesResource (getList, getListForUser): Added "id" field
- GrokResource, IndexFieldTypeProfileResource: Added "id" and other
valid fields from SEARCH_FIELD_MAPPING
Removed Invalid Fields:
- StreamResource: Removed "updated_at", "status" (not in
SEARCH_FIELD_MAPPING, didn't work)
- GrokResource: Removed "pattern" (not in search mapping)
- IndexSetsMappingResource: Reduced to "field_name" only (other fields
not implemented)
Fixed Constraint Type:
- ClusterLoggersResource: Removed inappropriate allowableValues range
constraint for numeric limit parameter (already has @Min validation)
Files with Identical Field Lists (13 files):
EventDefinitionsResource, EventNotificationsResource, PipelineResource,
RuleResource, CollectorResource, ConfigurationResource, SidecarResource,
ScriptingApiResource, AuthServiceBackendsResource, UsersResource,
TokenUsageResource, LookupTableResource - all have identical semantics,
just migrated annotation syntax.
Rationale:
All semantic differences were introduced to correct API documentation to
match actual backend implementation. Changes ensure that:
1. All advertised sort fields actually work
2. All functional sort fields are advertised
3. API spec accurately reflects backend capabilities
4. Bugs in master branch are fixed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add replacement for CLOUD_VISIBLE tag
* Add @PublicCloudAPI annotation to cloud-visible REST resources
Add @PublicCloudAPI annotation to 82 REST resources that were previously
marked with tags = {CLOUD_VISIBLE} in Swagger 2.x @Api annotations.
This annotation is used by CustomOpenAPIScanner to filter resources when
IS_CLOUD=true, ensuring only cloud-appropriate APIs are exposed in the
OpenAPI specification for cloud deployments.
Resources annotated:
- Events (4 resources): EventDefinitionsResource, EventNotificationsResource, etc.
- Pipeline Processor (5 resources): PipelineResource, RuleResource, SimulatorResource, etc.
- Sidecar (6 resources): SidecarResource, CollectorResource, ConfigurationResource, etc.
- Views/Search (15 resources): DashboardsResource, SavedSearchesResource, ViewsResource, etc.
- Security (6 resources): AuthzRolesResource, CAResource, ClientCertResource, etc.
- System (30+ resources): StreamResource, InputsResource, NotificationsResource, etc.
- Other resources (15+): MessageResource, EntitySuggestionResource, ContentPackResource, etc.
The @PublicCloudAPI annotation:
- Marks resources as available in public cloud deployments
- Does not appear in the generated OpenAPI specification
- Filters resources during OpenAPI generation when isCloud=true
- Replaces the old tags = {CLOUD_VISIBLE} approach from Swagger 2.x
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Migrate McpRestResource from Swagger 2.x to OpenAPI 3.x
Updates the MCP REST resource to use OpenAPI 3.x annotations, completing the migration of all REST resources in the project.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* WIP: add TODOS and subtype resolver prototype
* Add OpenAPI browser to help menu after merge conflict resolution
The OpenAPI browser menu item was lost during the merge when the help menu
was refactored from hardcoded items to a plugin-based registration system.
This restores the menu item in the new bindings.ts format.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Make legacy generator work with new annotations
* Remove unused CLOUD_VISIBLE flag
* Temporarily make test pass
* Use @RequestBody annotation instead of @Parameter
* Synchronize our not thread-safe custom reader
* Add discriminator mapping based on jackson annotations
* WIP command to generate a spec without a running server
* Add output file argument
* Don't hardcode any config parameters
* Add spec generation to maven build
* Move spec generation into profile
* Add generated spec to resources
* Attempt to stabilize spec format
* Adjust test to openapi 3.1 schema
* Resolve registered subtypes
* bind object mapper to provider
* don't skip empty subtype names
* update spec
* Revert extraction of ObjectMapperConfiguration
With the latest changes, it didn't have an effect
anymore.
* Expose OpenAPIContext to not hide the caching behavior
* Apply sorting for both web and command context
* use fully qualified type names in schema
* Fix broken discriminator mapping
* Add custom handling for ImmutableMap
* Split event expression types
Swagger can't deal with the generic type hierarchy.
It would generate faulty allOf's with refs to both
Expression<Boolean> and Expression<Number> in one
schema, e.g. for
`org.graylog.events.conditions.Expr.And`.
* Prevent duplicate operation IDs
* Skip NonApiResource annotated resources
* Add validation to spec command
* Replace terms "spec"/"specification" with "description"
* Update openapi description
* Switch to swagger-ui-react
* Serve description at openapi.yaml / openapi.json again
* Add missing license headers
* Add security schemes but hide them in swagger ui
* Update openapi description
* configure swagger ui
* add changelog
* qualify url to openapi.yaml
* Remove old api browser
* Rudimentary styling for swagger ui
* Fix broken handling of duplicate paths
* update openapi description
* fix changelog
* Remove swagger CSP group & deprecate DocumentationResource
* Update graylog2-server/src/main/java/org/graylog/api/GenerateOpenApiDescriptionCommand.java
Co-authored-by: Kay Roepke <kroepke@googlemail.com>
* create parent path if non-existent
* Polish print statements
* Remove term "Graylog"
* adjust RequestBody annotations to include schema ref in each case
* Update graylog2-server/src/main/java/org/graylog/api/GenerateOpenApiDescriptionCommand.java
Co-authored-by: Kay Roepke <kroepke@googlemail.com>
* Add annotations for success responses with declared response types
* treat Immutable(List|Set) as the java.util equivalents
* semver Version is serialized as a String in our api
* extract helper method and add overrides for joda-time and threeten classes
* HostAndPort is a string in openapi
* for ImmutableMap treat keys with GRN or joda-time DateTime types as strings for schema generation
* Add more missing response schemas
* Remove swagger annotations from datanode resource
* Add forbidden-apis rule for io.swagger.annotations.*
* Get rid of remaining ImmutableMap instances
* Remove openapi.yaml from VCS
* Execute OpenAPI desc generation in separate JVM
to avoid classloader issues due to bouncycastle
registration during command startup
* Add handling for java.time.Duration and simplify scalar type mapping
* More custom handling for various types
* `yarn format`
* Add special handling for FormDataContentDisposition in old swagger specs
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Kay Roepke <kroepke@googlemail.com>
* Install `@tanstack/react-table`.
* Implement tanstack table for core functionality of `EntityDataTable`.
* Reimplement sorting.
* Include bulk select column in tanstack table columns.
* Cleanup code
* Further cleanup code
* Create seperate component for `TableRow` again to be able to use `React.memo`.
* Cleanup `onSortChange` handler.
* Create separate hook to create react table object.
* Create separate hook for column definition generation.
* Move `useElementsWidth` hook into separate file.
* Start making use of tanstac table for row selection logic.
* Only create accessor columns for columns which exist as attributes in the entities.
* Fix linter hints
* Maintain column visibility in tanstack table.
* Use row id which does not include row index.
* Improve memorization of table rows. Fix issue where table row did not update after changing column visibility.
* Fixing tests
* Make use of tanstack table for logic related to selected entities.
* Align actions to the right.
* Fix name of `useColumnsWidth` hook.
* Add `indeterminate` prop for `Checkbox` component.
* Simplify bulk select col header.
* Remove errorprone `TableRow` memorization.
* Simplify `renderCell` usage.
* Avoid unnessecary unmounts of cell and header components.
* Extending entity list preferences with ability to hide columns + ordering.
* Adding tests.
* Do not return absent values.
* Improve naming of column related variables.
* Cleanup code
* Use only one array for information about column order and visibility. Before the arrays contained redundant information.
* Get rid of small `TableRow` component.
* Reverting accidental change.
* Restructure column definition creation.
* Migrating to JUnit6, fixing `ObjectMapper`.
* Properly type column definition meta.
* Injecting `MongoCollections` directly.
* Reverting accidental change.
* Fix column renderes for lookup table overview.
* Fixing finder query.
* Fix check if entity is selectable.
* Use stable refernece for `renderActions` functions, to fix tests.
* Fixing sort icon description
* Remove not needed file.
* Fix linter hints
* Cleanup code
* Fix issue with absent actions col.
* Update frontend implementation of user table preferences regarding API changes.
* Revert naming `EntityDataTable` prop `visibleColumns` to `visibleColumnOrder`
* Replace `visibleColumns` array prop in `EntityDataTable` for new `columnPreferences` object.
The `columnPreferences` also include information about hidden columns and custom column width.
With this change newly intorduced columns will be displayed by default.
* Update tests.
* Add `@dnd-kit/core`.
* Fixing type.
* FIxing type.
* Implement basic version of column reordering via drag and drop.
* Implement drag overlay.
* Display drag overlay next to cursor.
* Cleanup styling
* Include default column order in table layout.
* Update style guide examples
* Update style guide examples
* Remove no longer needed `BulkSelectHead`.
* Only update user column visibility preference for columns which have been explicitly hidden or shown.
* Install `@dnd-kit/sortable`.
* Persist column order in user preferences.
* Implement `PaginatedEntityTable` for index set field types usage modal.
* Implement `PaginatedEntityTable` for saved searches overview.
* Fixing TS errors
* Revert changes related to optimistic updates in user layout preferences hooks, since it does not have the desired effect.
* Improve drag overlay styling.
* Simplify `EntityDataTable` test.
* Remove useage of `useSortable` from table cells to simplify handling of drag overlay.
This also fixes the drag overlay position error when using a keyboard.
* Properly persist custom order in backend.
* Display drag overlay in portal.
* Fixing TS error.
* Adjust components for tests
* Fix previous merge.
* Update tests
* Cleanup.
* Add unit test
* Adding changelog.
* Create separate component for drag handle.
* Add missing license header.
* Memorize table.
* Improve rerendering performance by using css variables to apply drag and drop styles.
* Update test
* Simplifying type.
* Define activator ref for drag handle.
* Implement custom collision detection loic for dnd reordering.
This solves an issue where the indicator of the new column position was wrong when the cursor is outside the table con
tainer. It also solves an issue where a large column could not be dragged to the start or end of the table.
* Cleanup
* Remove unit test which is no longer compatible with new collision detection.
* Add missing license header
* Fixing linter hints
* Improve changelog.
---------
Co-authored-by: Dennis Oelkers <dennis@graylog.com>
* Install `@tanstack/react-table`.
* Implement tanstack table for core functionality of `EntityDataTable`.
* Reimplement sorting.
* Include bulk select column in tanstack table columns.
* Cleanup code
* Further cleanup code
* Create seperate component for `TableRow` again to be able to use `React.memo`.
* Cleanup `onSortChange` handler.
* Create separate hook to create react table object.
* Create separate hook for column definition generation.
* Move `useElementsWidth` hook into separate file.
* Start making use of tanstac table for row selection logic.
* Only create accessor columns for columns which exist as attributes in the entities.
* Fix linter hints
* Maintain column visibility in tanstack table.
* Use row id which does not include row index.
* Improve memorization of table rows. Fix issue where table row did not update after changing column visibility.
* Fixing tests
* Make use of tanstack table for logic related to selected entities.
* Align actions to the right.
* Fix name of `useColumnsWidth` hook.
* Add `indeterminate` prop for `Checkbox` component.
* Simplify bulk select col header.
* Remove errorprone `TableRow` memorization.
* Simplify `renderCell` usage.
* Avoid unnessecary unmounts of cell and header components.
* Improve naming of column related variables.
* Cleanup code
* Use only one array for information about column order and visibility. Before the arrays contained redundant information.
* Get rid of small `TableRow` component.
* Restructure column definition creation.
* Properly type column definition meta.
* Fix column renderes for lookup table overview.
* Fix check if entity is selectable.
* Use stable refernece for `renderActions` functions, to fix tests.
* Fixing sort icon description
* Remove not needed file.
* Fix linter hints
* Cleanup code
* Fix issue with absent actions col.
* Revert naming `EntityDataTable` prop `visibleColumns` to `visibleColumnOrder`
* Fixing issues where no table coluns where displayed, when attribute in user preferences is an empty object.
* Fixing typo.
* Fix name of `useColumnWidths` test.
---------
Co-authored-by: Dennis Oelkers <dennis@graylog.com>