Open ramarro123 opened 9 months ago
Hey! You should be able to set the API key in the ApiClient.java. Something like this:
ApiClient apiClient = new ApiClient();
apiClient.setApiKey("d4ff6dfcac1f2b37113007e820fd2269")
DefaultClient defaultClient = new DefaultClient(apiClient);
Let me know if this helps. I have not tried generating the client from the spec you linked.
I generated the java api. Here is an example usage:
package org.openapitools;
import org.openapitools.client.ApiException;
import org.openapitools.client.api.MetadataApi;
import org.openapitools.client.model.APIEntitiesMetadata;
class ExampleUsage {
public static void main(String[] args) throws ApiException {
MetadataApi client = new MetadataApi();
// Option 1
client.getApiClient().setApiKey("api-key-here");
// Option 2
client.getApiClient().addDefaultHeader("Private-Token", "api-key-here");
System.out.println("******** RESULT **********");
APIEntitiesMetadata result = client.getApiV4Metadata();
System.out.println(result);
System.out.println("**************************");
}
}
hi,
i try to generate client in java for https://gitlab.com/gitlab-org/gitlab/-/raw/master/doc/api/openapi/openapi.yaml
using java -jar openapi-generator-cli-7.3.0.jar generate -i openapi.yaml -g java --additional-properties=library=native,annotationLibrary=none
the problem is that private-token is not included anywhere so i can't add auth header
am i missing something in that? maybe the support for this kind of specs is missing?