micronaut-projects / micronaut-json-schema

Micronaut integration with JSON schema
Apache License 2.0
2 stars 1 forks source link

Create an initial version of the JSON schema processors #8

Closed andriy-dmytruk closed 6 months ago

andriy-dmytruk commented 7 months ago

Based on the proposal in this issue: https://github.com/micronaut-projects/micronaut-json-schema/issues/2.

The implementation includes a visitor that visits types that require a JSON schema and generates the files during build time.

Global configuration is available with the JsonSchemaConfiguration annotation.

andriy-dmytruk commented 7 months ago

I think for serving schemas is best to recommend users to use the Static Resources support as we do for OpenAPI instead of creating a controller.

I tried this using it, but there is a small problem. The schema URL (id) generally omits the .schema.json extension: https://json-schema.org/understanding-json-schema/structuring#id. The controller has a minor change of adding the extension if needed. If we could somehow solve this with static resources, that would be better, though.

andriy-dmytruk commented 7 months ago

Other changes look good. Thanks, Sergio!

sdelamo commented 7 months ago

Other changes look good. Thanks, Sergio!

Yes, I have another PR in progress. I wanted to send it today. But I will send it tomorrow.

andriy-dmytruk commented 7 months ago

@sdelamo Do we want to merge this now and send PRs for new fixes/features to master? At this point the PR is pretty large

sonarcloud[bot] commented 6 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
7.5% Coverage on New Code (required ≥ 70%)
1 New Bugs (required ≤ 0)
1 New Blocker Issues (required ≤ 0)
6 New Critical Issues (required ≤ 0)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint