Skip to content

Commit 17fee00

Browse files
pquentinswallez
authored andcommitted
Fix compiler-rs (#3083)
1 parent c8451bb commit 17fee00

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

.github/workflows/compiler-rs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Cargo Build & Test
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
9+
jobs:
10+
build_and_test:
11+
name: compiler-rs
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Use Node.js 20
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Install deps
23+
run: |
24+
make setup
25+
make generate
26+
make transform-to-openapi
27+
make transform-expand-generics
28+
29+
- name: Install Rust
30+
run: rustup update stable && rustup default stable
31+
32+
- run: cargo build --verbose
33+
working-directory: compiler-rs
34+
35+
- run: cargo test --verbose
36+
working-directory: compiler-rs

compiler-rs/clients_schema/src/transform/expand_generics.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ pub fn expand(model: IndexedModel, config: ExpandConfig) -> anyhow::Result<Index
152152
itf.inherits = Some(expand_inherits(inherit, &mappings, model, ctx)?);
153153
}
154154

155+
if !itf.behaviors.is_empty() {
156+
itf.behaviors.iter().for_each(|b| {
157+
if b.generics.is_empty() {
158+
// If the behavior has no generics, we can just expand it
159+
let _ = expand_type(&b.typ, Vec::new(), model, ctx);
160+
}
161+
});
162+
}
163+
155164
// We keep the generic parameters of behaviors, but expand their value
156165
for behavior in &mut itf.behaviors {
157166
for arg in &mut behavior.generics {
Binary file not shown.

compiler-rs/openapi_to_clients_schema/src/types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn generate_type_for_schema(
121121
})
122122
}
123123
if let Some(ref docs) = data.external_docs {
124-
base.ext_doc_url = Some(docs.ext_docs_url.clone())
124+
base.ext_doc_url = Some(docs.url.clone())
125125
}
126126

127127
// TODO: data.readonly/writeonly -> OverloadOf?
@@ -402,6 +402,8 @@ fn generate_interface_def(
402402
required: required.contains(&name),
403403
doc_id: None,
404404
doc_url: None,
405+
ext_doc_id: None,
406+
ext_doc_url: None,
405407
codegen_name: None, // FIXME: extension in workplace search
406408
description: None,
407409
aliases: Vec::default(),

0 commit comments

Comments
 (0)