Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] update jsonschema #8113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ genjsonschema: genjsonschema-cleanup $(GOJSONSCHEMA)
--output ./service/telemetry/generated_config.go \
--schema-package=https://opentelemetry.io/otelconfig/opentelemetry_configuration.json=github.com/open-telemetry/opentelemetry-collector/schema \
${OPENTELEMETRY_JSONSCHEMA_SRC_DIR}/schema/opentelemetry_configuration.json
@echo Modify jsonschema generated files.
sed -f $(TOOLS_MOD_DIR)/jsonschema_patch.sed service/telemetry/generated_config.go > service/telemetry/generated_config_tmp.go
mv service/telemetry/generated_config_tmp.go service/telemetry/generated_config.go
$(MAKE) fmt
$(MAKE) genjsonschema-cleanup

Expand Down
4 changes: 4 additions & 0 deletions internal/tools/jsonschema_patch.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# go-jsonschema always generates patternProperties as
# map[string]interface{}, for more specific types, they must
# be replaced here
s+type Headers.*+type Headers map[string]string+g
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think an actual patch to be applied by patch would be more resilient here (not a fan of sed specially after open-telemetry/opentelemetry-collector-contrib/issues/23981)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair, I can open an issue following this to use patch instead of sed for both jsonschema & proto generation

Loading
Loading