Skip to content

Commit 48567be

Browse files
committed
docs: add README doc for kafka-check-schemas hook
1 parent be43fb2 commit 48567be

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ want links to ephemeral thrid party stuff (slack, clubhouse, atlassian)
4343
#### `fastapi-generate-openapi-specification`
4444
Generate the Open API spec from a Fast API. If it has changed, write the new one and fails. If not, succeeds.
4545

46+
#### `kafka-check-schemas`
47+
48+
Check that the Kafka schemas present in the `schemas/` folder are consistent with the code.
49+
50+
This hook currently only supports the `scala` language for now and relies on the presence of the `sbt generateKafkaSchemas` command to re-generate and compare the schemas.
51+
52+
The implementation of the `generateKafkaSchemas` is up to each project, but you can find an [example of implementation] in the `template-kafka-stream-msk` project with the corresponding [sbt command] defined in the `build.sbt` file
53+
54+
Add these lines in your `.pre-commit-config.yaml` file to enable this pre-commit hook:
55+
```yaml
56+
repos:
57+
# [...]
58+
- repo: https://github.com/Kpler/kp-pre-commit-hooks.git
59+
rev: v0.22.0
60+
hooks:
61+
# [...]
62+
- id: kafka-check-schemas
63+
```
64+
65+
[example of implementation]: https://github.com/Kpler/template-kafka-stream-msk/blob/main/src/ci/scala/schema_generator/VulcanSchemaGenerator.scala
66+
[sbt command]: https://github.com/Kpler/template-kafka-stream-msk/blob/main/build.sbt#L75
67+
4668
### Contributing
4769

4870
#### Debugging / testing

0 commit comments

Comments
 (0)