OpenAPITools / OpenAPITools/openapi-generator
[BUG][dart-dio] property with type `AnyValue` ignores the `default` parameter
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Consider the following property schema:
"fooPropC": {
"default": "some default value"
},
or
"fooPropC": {
"type": "AnyValue",
"default": "some default value"
},
the default parameter here is completely ignored:
{
"openApiType": "AnyType",
"baseName": "fooPropC",
"complexType": "JsonObject",
"getter": "getFooPropC",
"setter": "setFooPropC",
"dataType": "JsonObject",
"datatypeWithEnum": "JsonObject",
"name": "fooPropC",
"defaultValueWithParam": " = data.fooPropC;",
"baseType": "JsonObject",
"example": "null",
"jsonSchema": "{\n \"type\" : \"AnyType\"\n}",
"exclusiveMinimum": false,
"exclusiveMaximum": false,
"required": false,
"deprecated": false,
"hasMoreNonReadOnly": false,
"isPrimitiveType": false,
"isModel": false,
"isContainer": false,
"isString": false,
"isNumeric": false,
"isInteger": false,
"isShort": false,
"isLong": false,
"isUnboundedInteger": false,
"isNumber": false,
"isFloat": false,
"isDouble": false,
"isDecimal": false,
"isByteArray": false,
"isBinary": false,
"isFile": false,
"isBoolean": false,
"isDate": false,
"isDateTime": false,
"isUuid": false,
"isUri": false,
"isEmail": false,
"isNull": false,
"isFreeFormObject": false,
"isAnyType": false,
"isArray": false,
"isMap": false,
"isEnum": false,
"isInnerEnum": false,
"isReadOnly": false,
"isWriteOnly": false,
"isNullable": false,
"isSelfReference": false,
"isCircularReference": false,
"isDiscriminator": false,
"vars": [],
"requiredVars": [],
"vendorExtensions": {
"x-index": 3
},
"hasValidation": false,
"isInherited": false,
"nameInCamelCase": "FooPropC",
"nameInSnakeCase": "FOO_PROP_C",
"uniqueItems": false,
"isXmlAttribute": false,
"isXmlWrapped": false,
"additionalPropertiesIsAnyType": false,
"hasVars": false,
"hasRequired": false,
"hasDiscriminatorWithNonEmptyMapping": false,
"hasMultipleTypes": false,
"schemaIsFromAdditionalProperties": false,
"datatype": "JsonObject",
"iexclusiveMaximum": false,
"hasItems": false
}
this is probably a bug with the core generator, since the raw schema doesn't include the default parameter "jsonSchema": "{\n \"type\" : \"AnyType\"\n}",
openapi-generator version
latest master: 6.3.0
@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08) @wing328
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the two provided schemas and inspect the OpenAPI Generator core path that builds the property metadata shown in the report. Trace why the default is absent from the raw schema for an AnyValue property, then verify that generated dart-dio output preserves the default value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100