OpenAPITools / OpenAPITools/openapi-generator

[BUG][OBJC] Method definitions to getOfflineState, getReachabilityStatus and setReachabilityStatus: missing from ApiClient implementation

Open
#6,125 0 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

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The interface in the header to the generated Objective-C API client declares methods that are missing from the implementation file.
https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h#L27

They generate these build warnings:

Method definition for 'getOfflineState' not found
Method definition for 'getReachabilityStatus' not found
Method definition for 'setReachabilityStatus:' not found

Calling these methods crashes with NSInvalidArgumentException.

openapi-generator version

4.3.0

OpenAPI declaration file content or url

Any OpenAPI declaration file including the samples generate the bug.

Command line used for generation

./bin/objc-petstore.sh

Steps to reproduce

Build the generated client library to observe the warnings. Call the methods to observe crashes.

E.g.

OpenApiClient.getOfflineState()
OpenApiClient.getReachabilityStatus()
OpenApiClient.setReachabilityStatus(AFNetworkReachabilityStatus.notReachable)
Related issues/PRs

N/A

Suggest a fix

These methods no longer reside in the ApiClient superclass, AFNetworking's AFHTTPSessionManager which is an AFURLSessionManager subclass itself. They reside in AFNetworkReachabilityManager. It would be best to remove them from the header interface.

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 with samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h and generate the sample using ./bin/objc-petstore.sh. Compare the declared reachability methods with the generated implementation and verify that the build warnings and runtime crashes are gone when those methods are called.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
api, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.