Skip to content

Comments

feat(idl-v2): IDL v2 template gen from AST (askama)#1110

Merged
vobradovich merged 3 commits intomaster-idl-v2from
vo/idl-v2-ast-templates
Nov 24, 2025
Merged

feat(idl-v2): IDL v2 template gen from AST (askama)#1110
vobradovich merged 3 commits intomaster-idl-v2from
vo/idl-v2-ast-templates

Conversation

@vobradovich
Copy link
Member

  • Added #[cfg_attr(feature = "templates", derive(askama::Template), template(...))] blocks so IdlDoc, ProgramUnit, and ServiceUnit now render Askama templates (idl.askama, program.askama, service.askama) when the optional templates feature is enabled, letting these top-level AST nodes be fed directly into the templating pipeline
  • Applied the same gated Askama derivations to the remaining data structures, wiring Type, StructDef, StructField, and EnumVariant to their respective template files (type.askama, struct_def.askama, field.askama, variant.askama), so nested types/events can also be rendered

@vobradovich
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 8 to 11
{%- if extends.len() > 0 %}
extends {
{%- for ext in extends %}
{%- endfor %}

Choose a reason for hiding this comment

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

P1 Badge Render service extends entries

In the new service.askama template the extends block iterates over extends but never renders ext, so a service that inherits other services will emit extends {} with no entries. When the templates feature is used, any service inheritance information is silently dropped from generated IDL, producing incorrect output for services with non-empty extends.

Useful? React with 👍 / 👎.

/// Another program constructor
/// (called once at the very beginning of the program lifetime)
Default();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

should be a new empty line, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

if only for readability, does not affect the parser

p2: ActorId,
p3: ManyVariants,
}
struct TupleStruct(u32);
Copy link
Contributor

Choose a reason for hiding this comment

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

new lines between types?

/// Another Counter service
Counter2: Counter,
}
types {
Copy link
Contributor

Choose a reason for hiding this comment

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

new line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same

@vobradovich vobradovich merged commit 8368cf7 into master-idl-v2 Nov 24, 2025
4 checks passed
@vobradovich vobradovich deleted the vo/idl-v2-ast-templates branch November 24, 2025 10:11
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.

3 participants