Skip to content

Conversation

@NimrodAvni78
Copy link

@NimrodAvni78 NimrodAvni78 commented Dec 15, 2025

TODO:
Read DefaultConfig struct and attach default config
Some fields only specify in comments what their possible fields are, making them a Named String type can make the schema more accurate with enums

Checklist

@NimrodAvni78 NimrodAvni78 changed the title Nimrodavni78/config json schema Config json schema generation Dec 15, 2025
@NimrodAvni78 NimrodAvni78 force-pushed the nimrodavni78/config-json-schema branch from 3acc24c to 3c6e393 Compare December 15, 2025 16:13
for _, pkg := range packagesToScan {
pkgPath := filepath.Join(moduleRoot, pkg)
if err := scanPackageForEnums(pkgPath); err != nil {
fmt.Fprintf(os.Stderr, "Warning: error scanning %s: %v\n", pkg, err)

Choose a reason for hiding this comment

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

is this a warning or an error?

Copy link
Author

Choose a reason for hiding this comment

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

yeah probably an error, will fix


func scanPackageForEnums(pkgPath string) error {
fset := token.NewFileSet()
pkgs, err := parser.ParseDir(fset, pkgPath, nil, parser.ParseComments)

Choose a reason for hiding this comment

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

ParseDir is deprecated

Copy link

@pinoOgni pinoOgni left a comment

Choose a reason for hiding this comment

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

very cool! Left some comments

@@ -133,6 +133,7 @@ type PrometheusConfig struct {

// Registry is only used for embedding Beyla within the Grafana Agent.

Choose a reason for hiding this comment

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

Beyla -> OBI (also for next line)

Copy link
Author

Choose a reason for hiding this comment

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

this is a beyla specific comment, becuase the embedding is beyla
so i left the comment but i added a new line so it wont be included in the schema

Copy link

@mmat11 mmat11 left a comment

Choose a reason for hiding this comment

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

looks good!

@NimrodAvni78 NimrodAvni78 requested a review from mmat11 December 16, 2025 13:03
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.

4 participants