OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
I have for the provided /subscriptions-endpoint two 2xx-responses:
200 OK with response MonitoringEventReport
201 CREATED with response MonitoringEventSubscription
But the generated Api contains only the POST with a response-type of MonitoringEventReport .
But I need to have both, so that it could be a 200 response with MonitoringEventReport or a 201 response with MonitoringEventSubscription
ℹ️ I am not allowed to edit this specification. ℹ️
Generated API-class
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-01T15:33:28.126276900+01:00[Europe/Berlin]")
@Component("com.test.network.api.Class5GcEpcApi")
public class Class5GcEpcApi {
private ApiClient apiClient;
public Class5GcEpcApi() {
this(new ApiClient());
}
@Autowired
public Class5GcEpcApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Creates a new subscription resource for monitoring event notification
*
* <p><b>201</b> - Created (Successful creation of subscription)
* <p><b>200</b> - The operation is successful and immediate report is included.
* <p><b>400</b> - Bad request
* <p><b>401</b> - Unauthorized
* <p><b>403</b> - Forbidden
* <p><b>404</b> - Not Found
* <p><b>411</b> - Length Required
* <p><b>413</b> - Payload Too Large
* <p><b>415</b> - Unsupported Media Type
* <p><b>429</b> - Too Many Requests
* <p><b>500</b> - Internal Server Error
* <p><b>503</b> - Service Unavailable
* <p><b>0</b> - Generic Error
* @param scsAsId Identifier of the SCS/AS (required)
* @param monitoringEventSubscription Subscription for notification about monitoring event (required)
* @return MonitoringEventReport
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public MonitoringEventReport scsAsIdSubscriptionsPost(String scsAsId, MonitoringEventSubscription monitoringEventSubscription) throws RestClientException {
return scsAsIdSubscriptionsPostWithHttpInfo(scsAsId, monitoringEventSubscription).getBody();
}
/**
* Creates a new subscription resource for monitoring event notification
*
* <p><b>201</b> - Created (Successful creation of subscription)
* <p><b>200</b> - The operation is successful and immediate report is included.
* <p><b>400</b> - Bad request
* <p><b>401</b> - Unauthorized
* <p><b>403</b> - Forbidden
* <p><b>404</b> - Not Found
* <p><b>411</b> - Length Required
* <p><b>413</b> - Payload Too Large
* <p><b>415</b> - Unsupported Media Type
* <p><b>429</b> - Too Many Requests
* <p><b>500</b> - Internal Server Error
* <p><b>503</b> - Service Unavailable
* <p><b>0</b> - Generic Error
* @param scsAsId Identifier of the SCS/AS (required)
* @param monitoringEventSubscription Subscription for notification about monitoring event (required)
* @return ResponseEntity<MonitoringEventReport>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity<MonitoringEventReport> scsAsIdSubscriptionsPostWithHttpInfo(String scsAsId, MonitoringEventSubscription monitoringEventSubscription) throws RestClientException {
Object localVarPostBody = monitoringEventSubscription;
// verify the required parameter 'scsAsId' is set
if (scsAsId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'scsAsId' when calling scsAsIdSubscriptionsPost");
}
// verify the required parameter 'monitoringEventSubscription' is set
if (monitoringEventSubscription == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'monitoringEventSubscription' when calling scsAsIdSubscriptionsPost");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("scsAsId", scsAsId);
final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap<String, Object> localVarFormParams = new LinkedMultiValueMap<String, Object>();
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
ParameterizedTypeReference<MonitoringEventReport> localReturnType = new ParameterizedTypeReference<MonitoringEventReport>() {};
return apiClient.invokeAPI("/{scsAsId}/subscriptions", HttpMethod.POST, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
}
}
openapi-generator version
7.2.0
OpenAPI declaration file content or url
paths:
/{scsAsId}/subscriptions:
post:
summary: Creates a new subscription resource for monitoring event notification
tags:
- 5GC/EPC
parameters:
- name: scsAsId
in: path
description: Identifier of the SCS/AS
required: true
schema:
type: string
requestBody:
description: Subscription for notification about monitoring event
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MonitoringEventSubscription'
responses:
"201":
description: Created (Successful creation of subscription)
content:
application/json:
schema:
$ref: '#/components/schemas/MonitoringEventSubscription'
headers:
Location:
description: "Contains the URI of the newly created resource"
required: true
schema:
type: string
"200":
description: The operation is successful and immediate report is included.
content:
application/json:
schema:
$ref: '#/components/schemas/MonitoringEventReport'
createSubscriptionResponse:
summary: Create response 200 for a new subscription
value:
externalId: "test@test.com"
monitoringType: "LOSS_OF_CONNECTIVITY"
lossOfConnectReason: 0
Description
I have for the provided /subscriptions-endpoint two 2xx-responses:
But the generated Api contains only the POST with a response-type of MonitoringEventReport .
But I need to have both, so that it could be a 200 response with MonitoringEventReport or a 201 response with MonitoringEventSubscription
ℹ️ I am not allowed to edit this specification. ℹ️
Generated API-class
openapi-generator version
7.2.0
OpenAPI declaration file content or url
Generation Details
Suggest a fix