OpenAPITools / OpenAPITools/openapi-generator

When generating w -t ...resource/go-server different results then w/o

Open
#10,747 4 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

In model_* files generated by the openapi-generator-cli-5.3.0.jar w/o specifying a template set w -t I find AssertErrorRequired functions. When I clone the go-server resources and point -t to them these functions are not in the model file.

/ AssertRecurseErrorRequired recursively checks if required fields are not zero-ed in a nested slice.
// Accepts only nested slice of Error (e.g. [][]Error), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseErrorRequired(objSlice interface{}) error {

I was hoping to make small modifications to the templates, but I have lost functionality on templates that have not been modified. My modified main generates as expected.

Additionally, I could not find the string "recursively checks" from the embedded comment anywhere in the openapi-generator repository, regardless of the version I inspected.

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

Reproduce generation with openapi-generator-cli-5.3.0.jar both with and without -t, using the go-server resources and the model_* outputs described here. Compare the default and cloned templates, then search the repository for AssertRecurseErrorRequired and its embedded comment. Done means the source of the lost function is identified and the behavior is corrected or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, java, openapi
Domain
backend-api-design, 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.