OpenAPITools / OpenAPITools/openapi-generator

Enhancement: Set isFreeFormObject property

Open
#1,315 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: General
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

A free-form object field in a model can be hard to distinguish from other types in the mustache template. Making this an explicit property would be helpful

openapi-generator version

3.3.1

OpenAPI declaration file content or url
	"object_field": { 
		"type":"object"
	}
Command line used for generation

This does not seem to be specific to any generator, although different generators deal with "object" differently -- some consider it to be a primitive type and others do not.

Steps to reproduce

Process any OpenAPI definition file with model containing a field like above.

Related issues/PRs

none

Suggest a fix/enhancement

For free-form object fields, set an isFreeFormObject property to true. Add this property field to CodegenParameter and CodegenProperty, as a peer to isString, isPrimitiveType, etc. I am not yet clear what logic should be used to set this field.

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 by reading CodegenParameter and CodegenProperty alongside the existing isString and isPrimitiveType fields, then trace how object fields are classified during generation. Determine the logic for identifying free-form objects and verify that the new property is populated and available to mustache templates across the relevant generators.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.