Skip to content

feat: automated AsyncAPI generation from Go structs - #8

Draft
jpower432 wants to merge 11 commits into
complytime:mainfrom
jpower432:feat/asyncapi-gen
Draft

feat: automated AsyncAPI generation from Go structs#8
jpower432 wants to merge 11 commits into
complytime:mainfrom
jpower432:feat/asyncapi-gen

Conversation

@jpower432

Copy link
Copy Markdown
Member

Summary

Please include a summary of the changes and the context of this PR.

Related Issues

Inform any issues relevant to this PR. For example:

  • Closes #ISSUE_NUMBER

Review Hints

  • Review hints here. Replace this text. Don't use the italics format!

  • Use this optional section to give any relevant information that could help the reviewer to more quickly and assertively understand and test the changes.

  • Good examples are useful commands, if it is better to review all commits together or in a suggested sequence, any relevant discussion in other PRs or issues, etc.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Implements AST-based parser that walks Go source files and returns
[]EventSpec values from structs annotated with the asyncapi sentinel
blank field pattern.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Remove unreachable `if field.Names != nil` guard in extractEventSpec
and replace string-concatenated temp path with filepath.Join in test.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Implements BuildDoc() converting []EventSpec to an AsyncAPIDoc model
with channels, send/receive operations, CloudEvents envelope schemas,
data schemas, and NATS JetStream bindings.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Adds missing assertion to TestBuildDoc_Operations verifying that the
receive operation carries an empty NATS stream (binding is send-only).

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Implements WriteYAML to marshal AsyncAPIDoc to disk with SPDX header
and 0o644 permissions.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Replaces the stub main.go with the full CLI entry point that wires
ParseFile, BuildDoc, and WriteYAML together. Adds the go:generate
directive and asyncapi sentinel tag to events/events.go, and commits
the generated api/events/asyncapi.yaml.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Adds generate, asyncapi-lint, and an expanded check task to Taskfile.yml.
Fixes NATS binding: stream name moved to x-stream extension (valid per
AsyncAPI spec extensions), bindingVersion set to 0.1.0 (was "latest").
Adds nolint directives for gosec G306 on intentional 0o644 file writes.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Extends BuildDoc and the asyncapi-gen CLI with optional -description,
-license, -contact-name, and -contact-url flags. Updates the go:generate
directive in events/events.go and regenerates api/events/asyncapi.yaml
with the full metadata matching the original hand-authored file.

Assisted-by: Claude (Anthropic, Claude Sonnet 4.6)
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
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.

1 participant