Skip to content

feat: new schema endpoints#145

Merged
CptSchnitz merged 11 commits intomasterfrom
schema-endpoints
Feb 2, 2026
Merged

feat: new schema endpoints#145
CptSchnitz merged 11 commits intomasterfrom
schema-endpoints

Conversation

@CptSchnitz
Copy link
Collaborator

No description provided.

- Add GET /schema/index endpoint for searchable schema index
- Add GET /schema/full endpoint for comprehensive schema metadata
- Implement schema indexing with category, version extraction
- Implement dependency extraction (internal and external refs)
- Implement environment variable extraction from x-env-value fields
- Add TypeScript type definitions extraction
- Add comprehensive integration tests for new endpoints
- Update OpenAPI spec with new endpoint definitions
- Install flexsearch dependency for future search functionality

Breaking changes: None
All existing endpoints remain unchanged
- Remove FlexSearch dependency from backend (not needed server-side)
- /schema/index now returns only schemas array (no searchIndex field)
- Frontend will build FlexSearch index client-side from schemas data
- With ~500 schemas (~100KB), client-side indexing is fast and simple
- Updated OpenAPI spec to reflect new response structure
- Updated integration tests to match new response format
- Regenerated TypeScript types from OpenAPI spec
- Updated BACKEND_SCHEMA_INTEGRATION.md with design decision

BREAKING CHANGE: /schema/index response no longer includes searchIndex field
- Fix null check in extractDependencies traverse function
  (prevents TypeError when schema has null property values)
- Add unit test to cover null value handling in metadata extraction
- Remove unsafe type assertions (as any) from schema controllers
- Fix OpenAPI spec to use additionalProperties for rawContent/dereferencedContent
- Regenerate TypeScript types from OpenAPI spec
- Fix magic number eslint error with INTERNAL_REF_PREFIX_LENGTH constant
- Remove explicit any from integration tests

All tests passing (109/109)
- Modified getTypeScriptForSchema to extract only the typeSymbol type
  instead of returning the entire .d.ts file
- Extracts content between 'readonly [typeSymbol]:' and 'readonly $id:'
- Falls back to full content if pattern not found
- Added unit test to verify typeContent extraction excludes imports/exports
- Fixed strict-boolean-expressions ESLint warnings for nullable strings

All tests passing (110/110)
- Replace regex approach with brace-counting algorithm
- Prevents capturing extra readonly fields after typeSymbol closing brace
- Now correctly extracts only the content inside typeSymbol object
- Added NOT_FOUND constant for indexOf -1 return value
- Enhanced test to verify readonly fields are excluded
- Tested with boilerplate schema that has 'readonly description' field

All tests passing (110/110)
- Changed extraction to include opening and closing braces
- Now returns valid TypeScript type object: { ... }
- Updated test to verify braces are present at start and end
- Formatting is preserved as-is from .d.ts file (includes newlines/indentation)

All tests passing (110/110)
@CptSchnitz CptSchnitz merged commit 1247cd3 into master Feb 2, 2026
4 of 5 checks passed
@CptSchnitz CptSchnitz deleted the schema-endpoints branch February 2, 2026 13:33
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