-
Notifications
You must be signed in to change notification settings - Fork 5
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
specgen: re-enable acceptance tests, fix validation issues, add more tests #212
Conversation
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.
I wonder if the second specgen
directory is really necessary. Left other comments. Let me know what you think @hariso
@@ -309,12 +326,12 @@ func (s *sourceWithSchemaExtraction) extractPayloadSchema(ctx context.Context, r | |||
} | |||
|
|||
func (s *sourceWithSchemaExtraction) schemaForType(ctx context.Context, data any, subject string) (schema.Schema, error) { | |||
srd, err := schema.KnownSerdeFactories[s.config.SchemaType].SerdeForType(data) | |||
srd, err := schema.KnownSerdeFactories[s.config.SchemaType()].SerdeForType(data) |
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.
I think we should check whether s.config.SchemaType()
returns a valid known type.
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.
We rely on that s.config.SchemaType()
converts s.config.SchemaTypeStr
to a schema.Type
, and SchemaTypeStr
has already been validated. But I think you have a point, I can add a test or two to make sure s.config.SchemaType()
is doing the conversion successfully.
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.
@hariso Just checking in. You haven't added a test for this, did you? Just in case I'm not seeing it.
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.
Ah, good catch, I forgot about this comment.:) I'll add a test or two now.
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.
I've added to another branch, that's specifically for unit tests: 6cf5795.
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.
Approving subject to a comment I left regarding a test for SchemaType()
Description
Closes #210.
This PR:
specgen/specgen/tests/parse_specs/
(tests related to parsing the specs)specgen/specgen/tests/write_and_combine/
(tests related to combining an existing connector.yaml file and the generated specs)SourceWithSchemaExtraction
.Quick checks: