diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f78ac73..806a80f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.24" + ".": "0.3.25" } diff --git a/CHANGELOG.md b/CHANGELOG.md index f4b9928..e3b7d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.3.25](https://github.com/cloudquery/codegen/compare/v0.3.24...v0.3.25) (2025-04-02) + + +### Bug Fixes + +* **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.76.0 ([#321](https://github.com/cloudquery/codegen/issues/321)) ([6ac2fcd](https://github.com/cloudquery/codegen/commit/6ac2fcd13c82f5f82bdea61f693fbdde90cd719d)) +* Make generating docs non destructive ([#323](https://github.com/cloudquery/codegen/issues/323)) ([eb90cda](https://github.com/cloudquery/codegen/commit/eb90cda66638d3115a2435abb24cc6a54bb08fd9)) + ## [0.3.24](https://github.com/cloudquery/codegen/compare/v0.3.23...v0.3.24) (2025-04-01) diff --git a/go.mod b/go.mod index fccdae7..28ccf14 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armmanagedapplications v1.2.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/solutions/armmanagedapplications/v2 v2.1.0 github.com/bradleyjkemp/cupaloy/v2 v2.8.0 - github.com/cloudquery/plugin-sdk/v4 v4.75.0 + github.com/cloudquery/plugin-sdk/v4 v4.76.0 github.com/google/go-cmp v0.7.0 github.com/invopop/jsonschema v0.13.0 github.com/jpillora/longestcommon v0.0.0-20161227235612-adb9d91ee629 @@ -25,7 +25,7 @@ require ( github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/buger/jsonparser v1.1.1 // indirect - github.com/cloudquery/cloudquery-api-go v1.13.7 // indirect + github.com/cloudquery/cloudquery-api-go v1.13.8 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/goccy/go-json v0.10.5 // indirect github.com/google/flatbuffers v25.2.10+incompatible // indirect diff --git a/go.sum b/go.sum index 815c18c..2c559b9 100644 --- a/go.sum +++ b/go.sum @@ -32,12 +32,12 @@ github.com/bradleyjkemp/cupaloy/v2 v2.8.0 h1:any4BmKE+jGIaMpnU8YgH/I2LPiLBufr6oM github.com/bradleyjkemp/cupaloy/v2 v2.8.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= -github.com/cloudquery/cloudquery-api-go v1.13.7 h1:XWn9TVLpKswTrNQT9MY/HUiQWwhyoMWKpGWoRcQM5bE= -github.com/cloudquery/cloudquery-api-go v1.13.7/go.mod h1:ZhEjPkDGDL2KZKlQLUnsgQ0mPz3qC7qftr37q3q+IcA= +github.com/cloudquery/cloudquery-api-go v1.13.8 h1:8n5D0G2wynbUdexr1GS8ND8i0uOwm0gXKNipJsijPe0= +github.com/cloudquery/cloudquery-api-go v1.13.8/go.mod h1:ZhEjPkDGDL2KZKlQLUnsgQ0mPz3qC7qftr37q3q+IcA= github.com/cloudquery/jsonschema v0.0.0-20240220124159-92878faa2a66 h1:OZLPSIBYEfvkAUeOeM8CwTgVQy5zhayI99ishCrsFV0= github.com/cloudquery/jsonschema v0.0.0-20240220124159-92878faa2a66/go.mod h1:0SoZ/U7yJlNOR+fWsBSeTvTbGXB6DK01tzJ7m2Xfg34= -github.com/cloudquery/plugin-sdk/v4 v4.75.0 h1:N/edo8VA+YzfjIC+bQ3y7AAUHQEYzF6y+ZFYLyHKFMI= -github.com/cloudquery/plugin-sdk/v4 v4.75.0/go.mod h1:dDLB0XrS3R+nIWh4X8J8/ZQcsJ+lmjxUxoBxhAq8iCA= +github.com/cloudquery/plugin-sdk/v4 v4.76.0 h1:4IdRzDSDfdy5zeU0ajJeMWgjFkuoopsGbXiOTfT6U/U= +github.com/cloudquery/plugin-sdk/v4 v4.76.0/go.mod h1:gmveeddqfFvMvBkgift+ctK4AiVIqsa0nWP/btMqSeY= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/jsonschema/docs/docs.go b/jsonschema/docs/docs.go index a93b351..160cf73 100644 --- a/jsonschema/docs/docs.go +++ b/jsonschema/docs/docs.go @@ -17,6 +17,8 @@ func generateDoc(root jsonschema.Schema, headerLevel int) (string, error) { return toc + "\n\n" + buff.String(), err } +// GenerateFromSchema generates a markdown documentation from a jsonschema.Schema. During the writing process the `Comment` attribute can be overwritten +// To avoid this use the `Generate` function which will not modify the original schema func GenerateFromSchema(schema jsonschema.Schema, headerLevel int) (string, error) { return generateDoc(schema, headerLevel) } @@ -131,7 +133,7 @@ func writeProperty(property *jsonschema.Schema, required bool, buff *strings.Bui } func writeDescription(sc *jsonschema.Schema, buff *strings.Builder) { - if len(sc.Description) == 0 { + if len(sc.Description) == 0 || sc.Comments == "skip_description" { return } @@ -139,7 +141,7 @@ func writeDescription(sc *jsonschema.Schema, buff *strings.Builder) { buff.WriteString(strings.ReplaceAll(sc.Description, "\n", "\n ")) buff.WriteString("\n") - sc.Description = "" // already used + sc.Comments = "skip_description" } func writeValueAnnotations(sc *jsonschema.Schema, buff *strings.Builder) { diff --git a/jsonschema/docs/docs_test.go b/jsonschema/docs/docs_test.go index 17f8c46..648c136 100644 --- a/jsonschema/docs/docs_test.go +++ b/jsonschema/docs/docs_test.go @@ -58,18 +58,18 @@ func TestGCP(t *testing.T) { func TestClickHouse(t *testing.T) { genSnapshot(t, "testdata/clickhouse.json") - genSnapshot(t, "testdata/clickhouse.json") + genSnapshotStruct(t, "testdata/clickhouse.json") } func TestFiletypes(t *testing.T) { genSnapshot(t, "testdata/filetypes.json") - genSnapshot(t, "testdata/filetypes.json") + genSnapshotStruct(t, "testdata/filetypes.json") } func TestFileDestination(t *testing.T) { genSnapshot(t, "testdata/file-destination.json") - genSnapshot(t, "testdata/file-destination.json") + genSnapshotStruct(t, "testdata/file-destination.json") }