Skip to content

Conversation

@vm-001
Copy link
Collaborator

@vm-001 vm-001 commented Jul 23, 2025

Summary

This PR enhances the OpenAPI Specification. Ideally, the spec should become the source of truth. However, the validation for the Plugin and its configuration is not flexible enough, and we must retain manual validation until OpenAPI 3.1.0 is supported.

issue #145

Benchmark

Roughly, using JSONSchema validation is about twice as slow as go-playground/validator(via reflection).

@codecov
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

❌ Patch coverage is 80.41667% with 47 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/openapi/openapi.go 81.30% 21 Missing and 2 partials ⚠️
utils/utils.go 64.28% 6 Missing and 4 partials ⚠️
db/entities/schema.go 62.50% 3 Missing and 3 partials ⚠️
db/entities/types.go 57.14% 2 Missing and 1 partial ⚠️
admin/api/api.go 88.88% 1 Missing and 1 partial ⚠️
admin/api/endpoints.go 75.00% 0 Missing and 1 partial ⚠️
admin/api/sources.go 75.00% 0 Missing and 1 partial ⚠️
admin/api/workspaces.go 75.00% 0 Missing and 1 partial ⚠️
Flag Coverage Δ
integration 76.27% <79.58%> (?)
unit 11.49% <3.75%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
admin/api/declarative.go 86.20% <100.00%> (+86.20%) ⬆️
admin/api/events.go 100.00% <100.00%> (+100.00%) ⬆️
admin/api/plugins.go 100.00% <100.00%> (+100.00%) ⬆️
app/app.go 81.49% <100.00%> (+81.49%) ⬆️
cmd/main/main.go 0.00% <ø> (ø)
db/entities/endpoint.go 83.33% <100.00%> (+83.33%) ⬆️
db/entities/event.go 100.00% <100.00%> (+100.00%) ⬆️
db/entities/plugin.go 72.85% <100.00%> (+72.85%) ⬆️
db/entities/source.go 100.00% <100.00%> (+100.00%) ⬆️
db/entities/workspace.go 100.00% <100.00%> (+100.00%) ⬆️
... and 11 more

... and 90 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vm-001 vm-001 force-pushed the feat/openapi-validator-v2 branch 3 times, most recently from 30f942c to ea39177 Compare July 23, 2025 14:48
case *openapi3.SchemaError:
node := validateErr.Fields
fields := se.JSONPointer()
for i, field := range fields {
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider array type invalid, for example attempts: [0, "123", 30], error msg will be {"attempts":[null,"value must be an integer"]}, need a test case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

@vm-001 vm-001 force-pushed the feat/openapi-validator-v2 branch 3 times, most recently from ac3caf9 to e821f62 Compare July 24, 2025 09:36
@vm-001 vm-001 force-pushed the feat/openapi-validator-v2 branch from da40019 to 01c4de8 Compare July 27, 2025 07:08
vm-001 and others added 4 commits July 28, 2025 16:44
Co-authored-by: cchenggit <cchenggit@users.noreply.github.com>
Signed-off-by: Yusheng Li <leeys.top@gmail.com>
@vm-001 vm-001 mentioned this pull request Jul 28, 2025
@vm-001 vm-001 requested a review from cchenggit July 28, 2025 09:48
Copy link
Contributor

@webhookx-x webhookx-x left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@cchenggit cchenggit left a comment

Choose a reason for hiding this comment

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

LGTM

@vm-001 vm-001 merged commit 88d314e into main Jul 29, 2025
8 checks passed
@vm-001 vm-001 deleted the feat/openapi-validator-v2 branch July 29, 2025 13:28
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.

3 participants