GithubHelp home page GithubHelp logo

launchdarkly / api-client-java Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 11.0 7.46 MB

LaunchDarkly API Client for Java

License: Other

Scala 0.01% Shell 0.01% Java 99.99%
api-client feature-flags feature-toggles java launchdarkly launchdarkly-api managed-by-terraform open-api

api-client-java's People

Contributors

brooswit avatar bwoskow-ld avatar carmenquan avatar intheclouddan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-client-java's Issues

Unable to get feature flag status

I've tried to use this example to get status of all my feature flags:
https://github.com/launchdarkly/api-client-java/blob/master/docs/FlagsApi.md#getFeatureFlagStatus

But I get this parsing exception:

	at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:323)
	at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:313)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
	at com.google.gson.Gson.fromJson(Gson.java:887)
	at com.google.gson.Gson.fromJson(Gson.java:852)
	at com.google.gson.Gson.fromJson(Gson.java:801)
	at io.swagger.client.JSON.deserialize(JSON.java:103)
	at io.swagger.client.ApiClient.deserialize(ApiClient.java:860)
	at io.swagger.client.ApiClient.handleResponse(ApiClient.java:1063)
	at io.swagger.client.ApiClient.execute(ApiClient.java:990)
	at io.swagger.client.api.FlagsApi.getFeatureFlagStatusesWithHttpInfo(FlagsApi.java:579)
	at io.swagger.client.api.FlagsApi.getFeatureFlagStatuses(FlagsApi.java:563)
	at com.schneiderelectric.ivan.launchdarkly.bot.LaunchdarklyBot.main(LaunchdarklyBot.java:27)
Caused by: java.lang.NumberFormatException: For input string: "2018-02-15T13:28:50.02Z"
	at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
	at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
	at java.lang.Double.parseDouble(Double.java:538)
	at com.google.gson.stream.JsonReader.nextLong(JsonReader.java:964)
	at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:321)
	... 13 more```

Seems like it's expecting a number but it's a date.

Not available in the Central Repo

When do we expect to have this client library available in the central repo?

Could not find artifact com.launchdarkly:api-client-java:jar:1.0.0 in central (https://repo.maven.apache.org/maven2)

ProjectsApi.getProjects fails with com.google.gson.JsonArray cannot be cast to class com.google.gson.JsonObject

Versions 10.0.0 to 12.0.0

ProjectsApi projectsApi = new ProjectsApi(...)
Projects result = projectsApi.getProjects(null, 0L, null, null);

Caused by: java.lang.ClassCastException: class com.google.gson.JsonArray cannot be cast to class com.google.gson.JsonObject (com.google.gson.JsonArray and com.google.gson.JsonObject are in unnamed module of loader 'app') at com.google.gson.JsonObject.getAsJsonObject(JsonObject.java:191) at com.launchdarkly.api.model.Project.validateJsonObject(Project.java:442) at com.launchdarkly.api.model.Projects.validateJsonObject(Projects.java:278) at com.launchdarkly.api.model.Projects$CustomTypeAdapterFactory$1.read(Projects.java:321) at com.launchdarkly.api.model.Projects$CustomTypeAdapterFactory$1.read(Projects.java:294) at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199) at com.google.gson.Gson.fromJson(Gson.java:1058) at com.google.gson.Gson.fromJson(Gson.java:1016) at com.google.gson.Gson.fromJson(Gson.java:959) at com.launchdarkly.api.JSON.deserialize(JSON.java:423) at com.launchdarkly.api.ApiClient.deserialize(ApiClient.java:847) at com.launchdarkly.api.ApiClient.handleResponse(ApiClient.java:1055) at com.launchdarkly.api.ApiClient.execute(ApiClient.java:979) at com.launchdarkly.api.api.ProjectsApi.getProjectsWithHttpInfo(ProjectsApi.java:519) at com.launchdarkly.api.api.ProjectsApi.getProjects(ProjectsApi.java:493)

FeatureFlag API request new API

We would like to see a new API on the FlagsApi that has the ability to compare the flag settings across the environments, so that we can quickly find discrepancies between the configurations across them.

This will help us ensure that the flags are properly configured across them all or not.

The required field `contextTargets` is not found in the JSON string

Upgrading from 13.0.0 to 14.0.0
[ERROR] The required field contextTargets is not found in the JSON string: {"rules":0,"nullRules":0,"targets":1}

Here's the relevant dump file content:

java.lang.IllegalArgumentException: The required field `contextTargets` is not found in the JSON string: {"rules":0,"nullRules":0,"targets":1}
	at com.launchdarkly.api.model.VariationSummary.validateJsonObject(VariationSummary.java:402)
	at com.launchdarkly.api.model.VariationSummary$CustomTypeAdapterFactory$1.read(VariationSummary.java:448)
	at com.launchdarkly.api.model.VariationSummary$CustomTypeAdapterFactory$1.read(VariationSummary.java:421)
	at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:204)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
	at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:186)
	at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:144)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
	at com.google.gson.TypeAdapter.fromJsonTree(TypeAdapter.java:299)
	at com.launchdarkly.api.model.FlagSummary$CustomTypeAdapterFactory$1.read(FlagSummary.java:274)
	at com.launchdarkly.api.model.FlagSummary$CustomTypeAdapterFactory$1.read(FlagSummary.java:245)
	at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:204)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
	at com.google.gson.TypeAdapter.fromJsonTree(TypeAdapter.java:299)
	at com.launchdarkly.api.model.FeatureFlagConfig$CustomTypeAdapterFactory$1.read(FeatureFlagConfig.java:967)
	at com.launchdarkly.api.model.FeatureFlagConfig$CustomTypeAdapterFactory$1.read(FeatureFlagConfig.java:938)
	at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:204)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
	at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:186)
	at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:144)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
	at com.google.gson.TypeAdapter.fromJsonTree(TypeAdapter.java:299)
	at com.launchdarkly.api.model.FeatureFlag$CustomTypeAdapterFactory$1.read(FeatureFlag.java:1129)
	at com.launchdarkly.api.model.FeatureFlag$CustomTypeAdapterFactory$1.read(FeatureFlag.java:1100)
	at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:204)
	at com.google.gson.Gson.fromJson(Gson.java:1227)
	at com.google.gson.Gson.fromJson(Gson.java:1137)
	at com.google.gson.Gson.fromJson(Gson.java:1047)
	at com.google.gson.Gson.fromJson(Gson.java:1014)
	at com.launchdarkly.api.JSON.deserialize(JSON.java:531)
	at com.launchdarkly.api.ApiClient.deserialize(ApiClient.java:847)
	at com.launchdarkly.api.ApiClient.handleResponse(ApiClient.java:1055)
	at com.launchdarkly.api.ApiClient.execute(ApiClient.java:979)
	at com.launchdarkly.api.api.FeatureFlagsApi.getFeatureFlagWithHttpInfo(FeatureFlagsApi.java:875)
	at com.launchdarkly.api.api.FeatureFlagsApi.getFeatureFlag(FeatureFlagsApi.java:849)

FeatureFlag lastModified is an integer, should be a long

The FeatureFlag model class has a field lastModified which stores the date/time of when the flag was last modified. It appears to be an epoch time, which means that the value is too large for an integer, this field should be a long. Or potentially be a DateTime object?

https://github.com/launchdarkly/api-client-java/blob/master/src/main/java/io/swagger/client/model/FeatureFlagConfig.java#L49

Consequently when calling getFeatureFlag using version 1.0.2 of the client we get the following exception.

Caused by: java.lang.NumberFormatException: Expected an int but was 1508177976363 at line 1 column 812 path $.environments..lastModified

Due to this bug, this API is broken and do not know of any workarounds. Please fix or provide alternatives. Thank you!

Exception when calling Configuration.getDefaultApiClient()

I'm trying to instantiate the Java API client, as mentioned in the documentation:

ApiClient apiClient = Configuration.getDefaultApiClient();

When I call this, I get the following exception:

java.lang.NoClassDefFoundError: org/threeten/bp/temporal/TemporalAccessor
	at com.launchdarkly.api.JSON.<init>(JSON.java:49)
	at com.launchdarkly.api.ApiClient.init(ApiClient.java:125)
	at com.launchdarkly.api.ApiClient.<init>(ApiClient.java:85)
	at com.launchdarkly.api.Configuration.<clinit>(Configuration.java:18)

I'm referencing a local copy of the JAR file downloaded from Maven's repository (
https://search.maven.org/artifact/com.launchdarkly/api-client/6.0.0/jar ). Is it not possible to reference the Java API client in this fashion?

stop using deprecated `okhttp` v2, upgrade to at least `okhttp3`

This API client currently depends on OkHttp v2:

<okhttp-version>2.7.5</okhttp-version>

V2 is considered to be deprecated since okhttp3 was released in 2016:

This release obsoletes OkHttp 2.x, and all code that uses OkHttp’s com.squareup.okhttp package should upgrade to the okhttp3 package. Libraries that depend on OkHttp should upgrade quickly to prevent applications from being stuck on the old version.

We had a specific case recently where this caused problems. Some newer code of ours which uses okhttp3 pulls in okio 2.x as a transitive dependency. But because this LD API client code uses okhttp 2.7.5 and indirectly depends on okio 1.6.0, we have a dependency conflict: the newer okhttp3 cannot work with okio 1.6.0, and the older okhttp v2 used by the LD API client cannot work with the newer okio 2.x.

Please upgrade to a more recent version of okhttp to prevent issues in newer applications using this client.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.