OpenAPITools / OpenAPITools/openapi-generator

[Ignore ref tags in yaml Typescript Generator] Unable to load RELATIVE ref

Open
#13,239 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We have a requirement to generate Angular services and models using the same OpenAPI YAML that we are using to generate Implementation interfaces, request and response objects on the Java side. Below is an example of such YAML. There is no problem in client generation on both Java and Angular side but just on the Angular repository we don't want to generate models for some of the response types. Ex- for 500, 503 and 400 response codes.
Reason for that is we do not have access to error-response.yml on Angular side. So we just want to ignore client generation for response codes 500, 503, and 400.
Please let me know if there a way of doing so in typescript?

/document/upload:
post:
summary: Uploads Document for sysdocs
operationId: uploadSysdoc
tags:
- documents
requestBody:
content:
multipart/form-data: # Media type
schema: # Request payload
$ref: '../schemas/document.yml#/components/schemas/SysdocFileUpload'
parameters:
- name: fileTypeEnum
in: query
x-constraints: "@NotNull(message = "{fileupload.file.type.required}")"
schema:
{ $ref: '../schemas/document.yml#/components/schemas/FileType' }
required: true
responses:
'200':
$ref: '../schemas/maintenance.yml#/components/responses/uploadResponse'
'500':
$ref: "../commons/error-response.yml#/components/responses/internalError"
'503':
$ref: "../commons/error-response.yml#/components/responses/serviceUnavailable"
'400':
$ref: "../commons/error-response.yml#/components/responses/badRequest"

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 OpenAPI YAML example, especially the response references for 500, 503, and 400 and the relative error-response.yml path. Trace how TypeScript/Angular generation handles those response references and determine how they could be excluded without affecting the 200 response. Done means the requested responses are omitted while the remaining client models and services still generate successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.