From 32082b0a620ef94aa883dfba381b9ea9b57f77cd Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Thu, 20 May 2021 14:08:28 -0700 Subject: [PATCH] Do not support methods with header parameters --- srcgen/endpoints.rs.dt | 5 ++++- srcgen/meta.rs.dt | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/srcgen/endpoints.rs.dt b/srcgen/endpoints.rs.dt index 393d21f..cd8b24f 100644 --- a/srcgen/endpoints.rs.dt +++ b/srcgen/endpoints.rs.dt @@ -65,8 +65,11 @@ impl<'a> {{= endpoint }}<'a> { for (let [ route, path ] of endpointMethods) { let get = path.get; - if (!get) + if (!get) /* Only support GET parameters. */ continue; + if ((get.parameters || []).some(p => 'header' === p.in)) /* Do not support header parameter methods. */ + continue; + let operationId = get.operationId; let method = dotUtils.changeCase.snakeCase(operationId.slice(operationId.indexOf('.') + 1)); diff --git a/srcgen/meta.rs.dt b/srcgen/meta.rs.dt index 0c28fb0..a4efd81 100644 --- a/srcgen/meta.rs.dt +++ b/srcgen/meta.rs.dt @@ -20,8 +20,11 @@ lazy_static! { {{ for (const [ route, path ] of Object.entries(spec.paths)) { const get = path.get; - if (!get) + if (!get) /* Only support GET parameters. */ continue; + if ((get.parameters || []).some(p => 'header' === p.in)) /* Do not support header parameter methods. */ + continue; + const operationId = get.operationId; }} map.insert("{{= route }}", "{{= operationId }}");