OpenAPITools / OpenAPITools/openapi-generator

[BUG] Headers not copied into Raw response headers array.

Open
#6,527 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: TypeScript Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • [ y] Have you provided a full/minimal spec to reproduce the issue?
  • [ y] Have you validated the input using an OpenAPI validator (example)?
  • [ y] What's the version of OpenAPI Generator used?
  • [ y] Have you search for related issues/PRs?
  • [ y] What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When calling this method I know from the documents that the response provides details of a document created in the header.location but I can't examine this with the typescript-fetch API? The following snippet from a React test app is where I see the response headers are empty. If I use the standard dap


var config = new Configuration({
    apiKey: "ApiKey mykeywashere:mysecret",
    basePath: 'https://<basepath>.amazonaws.com/v1_cors'
  });

  dapi = new DocumentApi(config);

  var d = new DocumentPostFromJSON({
    "group": "/api/v1/group/legalesigndev/",
    "name": "SDK Special Test Document",
    "text": "<h1>Automatic Unit Test Document</h1><p>terms as follows.. <span class=\"field\" data-optional=\"false\" data-name=\"Please add your ...\" data-idx=\"0\" data-signee=\"1\" data-type=\"signature\" data-options=\"\"> ....... </span></p>",
    "signers": [{ "firstname": "fname", "lastname": "lname", "email": "lex@test.com", "order": 0 }],
    "do_email": "false",
    "offset": "",
    "archived": "false",
    "limit": "",
    "filter": ""
  });
  var dpr = {
    "documentPost": d
  };
  console.log("Testing postDocument");
  const out = await dapi.postDocumentRaw(dpr);
  console.log(await out);
  console.log(await out.raw.headers)
openapi-generator version

4.3.1

OpenAPI declaration file content or url

https://raw.githubusercontent.com/legalesign/Legalesign-V1-OpenAPI3/master/legalesign-api-v1.yaml

Command line used for generation

openapi-generator generate -i https://raw.githubusercontent.com/legalesign/Legalesign-V1-OpenAPI3/master/legalesign-api-v1.yaml -g typescript-fetch --additional-properties supportsES6=true

Steps to reproduce

Execute generation, make any Raw Api call - check response.headers.

Related issues/PRs

https://github.com/swagger-api/swagger-codegen/issues/7828

Suggest a fix

Should the baseApi.fetchApi.response be mapping onto this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the typescript-fetch generator output and the baseApi.fetchApi.response path mentioned in the report. Reproduce the issue using the supplied OpenAPI declaration, generation command, and a Raw API call, then verify that response.headers contains the server headers, including header.location.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.