Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/samples-java-play-framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- samples/server/petstore/java-play-framework-fake-endpoints
- samples/server/petstore/java-play-framework-fake-endpoints-with-security
- samples/server/petstore/java-play-framework-no-bean-validation
- samples/server/petstore/java-play-framework-no-exception-handling
- samples/server/petstore/java-play-framework-no-excp-handling
- samples/server/petstore/java-play-framework-no-interface
- samples/server/petstore/java-play-framework-no-nullable
- samples/server/petstore/java-play-framework-no-swagger-ui
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-spring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- samples/openapi3/server/petstore/springboot-delegate
- samples/openapi3/server/petstore/spring-boot-oneof
- samples/server/petstore/spring-boot-nullable-set
- samples/server/petstore/spring-boot-defaultInterface-unhandledException
- samples/server/petstore/spring-boot-defaultInterface-unhandledExcp
- samples/server/petstore/springboot
- samples/server/petstore/springboot-beanvalidation
- samples/server/petstore/springboot-builtin-validation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generatorName: java-play-framework
outputDir: samples/server/petstore/java-play-framework-no-exception-handling
outputDir: samples/server/petstore/java-play-framework-no-excp-handling
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaPlayFramework
additionalProperties:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generatorName: spring
outputDir: samples/server/petstore/spring-boot-defaultInterface-unhandledException
outputDir: samples/server/petstore/spring-boot-defaultInterface-unhandledExcp
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
Expand Down
10 changes: 9 additions & 1 deletion bin/generate-samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ else

# shellcheck disable=SC2086
# shellcheck disable=SC2068
java ${JAVA_OPTS} -jar "$executable" batch ${BATCH_OPTS} --includes-base-dir "${root}" --fail-fast -- ${files[@]}
if java ${JAVA_OPTS} -jar "$executable" batch ${BATCH_OPTS} --includes-base-dir "${root}" --fail-fast -- ${files[@]} 2>&1 | tee /dev/pts/0 | grep -q -i "exception"; then
echo "Found exception(s) when running the generator(s) to update the samples."
export GENERATE_ERROR=1
fi
fi

if [[ -n "$GENERATE_ERROR" ]]; then
echo "Found exception(s) when running the generator(s) to update the samples."
# UNCOMMENT LATER
#exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -2798,9 +2798,8 @@ components:
format: float32
- type: object
$ref: '#/components/schemas/MixedSubId'

description: Mixed anyOf types for testing
MixedSubId:
properties:
id:
type: string
type: string
Original file line number Diff line number Diff line change
Expand Up @@ -2856,7 +2856,6 @@ components:
format: float32
- type: object
$ref: '#/components/schemas/MixedSubId'

description: Mixed anyOf types for testing
MixedSubId:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,64 @@ paths:
type: array
items:
$ref: '#/components/schemas/Pony'
/fake/null-request-body:
get:
summary: to ensure null request body wont' throw exception
operationId: null-request-body
parameters:
- name: Accept-Language
in: header
schema:
type: string
example: application/json
requestBody:
content:
text/plain:
examples:
Generar Orden por External ID:
value: |-
{
"external_reference": "{{external_order_ref}}",
"notification_url": "www.yourserver.com/yourendpoint",
"sponsor_id": 446566691,
"items": [
{
"title": "Papas frita",
"currency_id": "{{currency_id}}",
"unit_price": 6000,
"quantity": 1
},
{
"title": "Gaseosa",
"currency_id": "{{currency_id}}",
"unit_price": 3000,
"quantity": 1
}
]/*,
"taxes": [
{
"value": 0,
"type": "IVA"
}
]*/
}
responses:
'200':
description: ''
/myExample:
get:
responses:
'200':
description: Response
content:
application/json:
schema:
oneOf:
- type: array
items:
"$ref": "#/components/schemas/OneOf1"
- type: object
"$ref": "#/components/schemas/OneOf1"
Comment on lines +76 to +77
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: A schema object cannot define both type and $ref; this oneOf entry should reference OneOf1 directly instead of combining it with inline keywords.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/test/resources/3_0/enum-implements.yaml, line 76:

<comment>A schema object cannot define both `type` and `$ref`; this `oneOf` entry should reference `OneOf1` directly instead of combining it with inline keywords.</comment>

<file context>
@@ -17,6 +17,64 @@ paths:
+                  - type: array
+                    items:
+                      "$ref": "#/components/schemas/OneOf1"
+                  - type: object
+                    "$ref": "#/components/schemas/OneOf1"
 components:
</file context>
Suggested change
- type: object
"$ref": "#/components/schemas/OneOf1"
+ - $ref: '#/components/schemas/OneOf1'
Fix with Cubic

components:
schemas:
Pony:
Expand All @@ -30,4 +88,9 @@ components:
enum:
- Earth
- Pegasi
- Unicorn
- Unicorn
OneOf1:
type: object
properties:
message1:
type: string
Original file line number Diff line number Diff line change
Expand Up @@ -1297,52 +1297,6 @@ paths:
responses:
200:
description: OK
/fake/null-request-body:
get:
tags:
- another_fake
summary: null request body
operationId: null-request-body
parameters:
- name: Accept-Language
in: header
schema:
type: string
example: application/json
requestBody:
content:
text/plain:
examples:
Generar Orden por External ID:
value: |-
{
"external_reference": "{{external_order_ref}}",
"notification_url": "www.yourserver.com/yourendpoint",
"sponsor_id": 446566691,
"items": [
{
"title": "Papas frita",
"currency_id": "{{currency_id}}",
"unit_price": 6000,
"quantity": 1
},
{
"title": "Gaseosa",
"currency_id": "{{currency_id}}",
"unit_price": 3000,
"quantity": 1
}
]/*,
"taxes": [
{
"value": 0,
"type": "IVA"
}
]*/
}
responses:
'200':
description: ''
'/fake/pet/{petId}/uploadImage':
post:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ paths:
- type: array
items:
"$ref": "#/components/schemas/OneOf1"
- type: object
"$ref": "#/components/schemas/OneOf1"
- "$ref": "#/components/schemas/OneOf1"
components:
schemas:
OneOf1:
type: object
properties:
message1:
type: string
type: string
1 change: 0 additions & 1 deletion samples/client/petstore/java/okhttp-gson/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ Class | Method | HTTP request | Description
*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
*AnotherFakeApi* | [**getParameterArrayNumber**](docs/AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value
*AnotherFakeApi* | [**getParameterStringNumber**](docs/AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number
*AnotherFakeApi* | [**nullRequestBody**](docs/AnotherFakeApi.md#nullRequestBody) | **GET** /fake/null-request-body | null request body
*DefaultApi* | [**fakeAnyOfWIthSameErasureGet**](docs/DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure |
*DefaultApi* | [**fakeFreeFormQueryParametersGet**](docs/DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters |
*DefaultApi* | [**fakeOneOfWIthSameErasureGet**](docs/DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure |
Expand Down
51 changes: 0 additions & 51 deletions samples/client/petstore/java/okhttp-gson/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1404,57 +1404,6 @@ paths:
- another_fake
x-accepts:
- application/json
/fake/null-request-body:
get:
operationId: null-request-body
parameters:
- explode: false
in: header
name: Accept-Language
required: false
schema:
example: application/json
type: string
style: simple
requestBody:
content:
text/plain:
examples:
Generar Orden por External ID:
value: |-
{
"external_reference": "{{external_order_ref}}",
"notification_url": "www.yourserver.com/yourendpoint",
"sponsor_id": 446566691,
"items": [
{
"title": "Papas frita",
"currency_id": "{{currency_id}}",
"unit_price": 6000,
"quantity": 1
},
{
"title": "Gaseosa",
"currency_id": "{{currency_id}}",
"unit_price": 3000,
"quantity": 1
}
]/*,
"taxes": [
{
"value": 0,
"type": "IVA"
}
]*/
}
responses:
"200":
description: ""
summary: null request body
tags:
- another_fake
x-accepts:
- application/json
/fake/pet/{petId}/uploadImage:
post:
description: ""
Expand Down
60 changes: 0 additions & 60 deletions samples/client/petstore/java/okhttp-gson/docs/AnotherFakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags |
| [**getParameterArrayNumber**](AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value |
| [**getParameterStringNumber**](AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number |
| [**nullRequestBody**](AnotherFakeApi.md#nullRequestBody) | **GET** /fake/null-request-body | null request body |


<a id="call123testSpecialTags"></a>
Expand Down Expand Up @@ -190,62 +189,3 @@ No authorization required
|-------------|-------------|------------------|
| **200** | OK | - |

<a id="nullRequestBody"></a>
# **nullRequestBody**
> nullRequestBody(acceptLanguage)

null request body

### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.AnotherFakeApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");

AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
String acceptLanguage = "application/json"; // String |
try {
apiInstance.nullRequestBody(acceptLanguage);
} catch (ApiException e) {
System.err.println("Exception when calling AnotherFakeApi#nullRequestBody");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```

### Parameters

| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **acceptLanguage** | **String**| | [optional] |

### Return type

null (empty response body)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: text/plain
- **Accept**: Not defined

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | | - |

Loading
Loading