-
Notifications
You must be signed in to change notification settings - Fork 534
Move generated schemas into sub-folders #1024
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
Conversation
5fead4e
to
cec4252
Compare
rebased and updated tests |
@@ -4,6 +4,7 @@ import ( | |||
"testing" | |||
|
|||
er "github.com/elastic/apm-server/processor/error" | |||
generatedschemas "github.com/elastic/apm-server/processor/error/generated-schemas" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pleas use schema
over schemas
- as Rakyll's post points out package names should not be plural but singular.
I am not a huge fan of having generated-schemas
in the path. The package name is schemas
, the import path ends with generated-schemas
and it needs to be overwritten with generatedschemas
- if not absolutely necessary I'd rather avoid that.
How about either
- getting rid of
generated
and just useschema
- or use
generated/schema
folder structure to have a cleaner import. This would also allow to add further generated files in the future if necessary.
{"sourcemaps/payload.json", "processor/sourcemap/schema.go", "sourcemapSchema", "sourcemap"}, | ||
{"errors/payload.json", "processor/error/generated-schemas/payload.go", "PayloadSchema"}, | ||
{"transactions/payload.json", "processor/transaction/generated-schemas/payload.go", "PayloadSchema"}, | ||
{"sourcemaps/payload.json", "processor/sourcemap/generated-schemas/payload.go", "SourcemapSchema"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name SourcemapSchema
is not consistent - please also change to PayloadSchema
.
6ea8c8c
to
bff5e83
Compare
thanks @simitt! Updated and rebased. |
jenkins, retest this please |
jenkins, retest this please |
This moves generated schemas into their own sub-folders in their respective processors.
This is extracted from the work on intake v2.
Right now, I think it's nice to have auto-generated and human-generated source code separately.
In the future for intake v2, we'll need to validate entities like errors and transactions separate from the payload, which means we'll need to have the schemas separate for the individual entities.
When we add the individual schemas (errors, transactions) in the future, we'd be putting even more auto-generated files in the same directories as the human-generated code, if we didn't have a sub-folder for it.
I went ahead and gave the schema constants names (
const PayloadSchema
) instead of using theSchema()
method, because we'll need to have more schemas in the package in the future.