Coder Social home page Coder Social logo

ld-openapi's People

Contributors

arun251 avatar ashanbrown avatar atrakh avatar brooswit avatar bwoskow-ld avatar dbolson avatar drichelson avatar eli-darkly avatar g-a-d avatar goyanespaula avatar hjacobs1 avatar intheclouddan avatar jamesbar2 avatar jkodumal avatar kbrackbill avatar launchdarklyci avatar launchdarklyreleasebot avatar ldhenry avatar levlaz avatar lexiross avatar mlafeldt avatar obiknows avatar rengawm avatar rmanalan avatar sarahlessner avatar sloloris avatar tim-launchdarkly avatar traciklopez avatar wiredferret avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  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

ld-openapi's Issues

published swagger.yaml mismatch

is this still the correct url for consumers?:

https://launchdarkly.github.io/ld-openapi/swagger.yaml

it is quite out of date, so i am compiling this locally and using output at the moment.

i also notice the swagger naming of tags in this repo no longer matches the published swagger file. eg. 'flags' has become 'Feature flags'. this means that the generated client from swagger-js results in a different interface for api calls - breaking contract and anything that depends on it.

ie.
old api containing functions:

(projects={}, environments={}, flags={}, users={}, user settings={}, audit log={}, webhooks={}, root={})

new api containing functions

(Projects={}, Environments={}, Feature flags={}, Users={}, User settings={}, Audit log={}, Webhooks={}, Custom roles={}, Team members={}, Root={})

for example this call using the generated client no longer works because the 'flags' api no longer exists.

this.apiClient.apis.flags.getFeatureFlags({ projectKey: projectKey });

refer: https://github.com/wyvern8/launchdarkly-nodeutils which works with the copy taken from published url, but not the swagger generated from this repo. (update: repo is updated to match new structures)

here are the notes as to how the api is generated
https://github.com/swagger-api/swagger-js#tags-interface

Python SDK does not work with Python 3.7

Per https://docs.python.org/3/whatsnew/3.7.html async is now a reserved keyword. This causes the generated client to break when using python 3.7 with the following error message.

(venv) ld-mbp:SupportService levlaz$ python cli.py
Traceback (most recent call last):
  File "cli.py", line 1, in <module>
    from launchdarkly_api import Configuration, ProjectsApi, ApiClient
  File "/Users/levlaz/git/SupportService/lib/api-client-python/launchdarkly_api/__init__.py", line 19, in <module>
    from launchdarkly_api.api.audit_log_api import AuditLogApi
  File "/Users/levlaz/git/SupportService/lib/api-client-python/launchdarkly_api/api/__init__.py", line 6, in <module>
    from launchdarkly_api.api.audit_log_api import AuditLogApi
  File "/Users/levlaz/git/SupportService/lib/api-client-python/launchdarkly_api/api/audit_log_api.py", line 139
    async=params.get('async'),
        ^
SyntaxError: invalid syntax

Default environments make life difficult for API consumers

Hey,

Thanks for the excellent OpenAPI specification. I've successfully used it to generate a Go client library, and it's been working great overall! ๐Ÿ‘

I've been using the Go library as part of my brand-new Terraform provider for LaunchDarkly:

https://github.com/mlafeldt/terraform-provider-launchdarkly

At this moment, the provider allows to manage LaunchDarkly projects, environments, and feature flags. While it works great in general, there are at least two known issues that make development of a proper provider kind of difficult:

  1. Creating a new project via the LaunchDarkly API will, unfortunately, also create two environments by default (Production and Test). It's not possible to delete both since at least one must exist. The launchdarkly_project and launchdarkly_environment resources don't handle this case in a good way yet. As a workaround, it's possible to import these special environments via terraform import.
  2. Even if we could solve the previous issue, there would still be the problem that there must be at least one project, making it impossible to have a clean slate using Terraform.

I hope you can see how providing API endpoints for creating projects and environments, with the former interfering with the latter, can cause the mentioned problems for API consumers. As far as I can see, there's no way to change this surprising behavior. Please advise.

FeatureFlagStatus _links property should have `parent` link

FeatureFlagStatus is missing parent link in their _links properties. The parent should be a link to the feature flag. Because it's missing from the definition, it's impossible to link statuses to feature flags.
The server returns parent links, but the generated client api ignores them because they're not in the spec

Release 2.0.20 breaks when `bravado` tries to validate the swagger spec

This is how I have been usingld-openapi

from bravado.client import SwaggerClient
client_api = SwaggerClient.from_url('https://launchdarkly.github.io/ld-openapi/openapi.json')

As of 2.0.20, it leads to this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/bravado/client.py", line 107, in from_url
    return cls.from_spec(spec_dict, spec_url, http_client, config)
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/bravado/client.py", line 134, in from_spec
    spec_dict, origin_url, http_client, config,
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/bravado_core/spec.py", line 185, in from_dict
    spec.build()
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/bravado_core/spec.py", line 197, in build
    self._validate_spec()
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/bravado_core/spec.py", line 193, in _validate_spec
    http_handlers=self.get_ref_handlers(),
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/swagger_spec_validator/validator20.py", line 163, in validate_spec
    http_handlers=http_handlers,
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 29, in wrapper
    sys.exc_info()[2])
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/swagger_spec_validator/common.py", line 24, in wrapper
    return method(*args, **kwargs)
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/swagger_spec_validator/validator20.py", line 215, in validate_json
    cls=Draft4Validator,
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/swagger_spec_validator/ref_validators.py", line 52, in validate
    instance_cls(schema, *args, **kwargs).validate(instance)
  File "/Users/savinay/.pyenv/versions/2.7.14/lib/python2.7/site-packages/jsonschema/validators.py", line 353, in validate
    raise error
swagger_spec_validator.common.SwaggerValidationError: ("{u'description': u'Returns timeseries data and all sdk versions.', u'schema': {u'x-scope': ['https://launchdarkly.github.io/ld-openapi/openapi.json'], u'$ref': u'#/definitions/MAUbyCategory'}} is not valid under any of the given schemas\n\nFailed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:\n    {'oneOf': [{'$ref': '#/definitions/response'},\n               {'$ref': '#/definitions/jsonReference'}]}\n\nOn instance['paths'][u'/usage/mau/bycategory']['get']['responses'][u'200']:\n    {u'description': u'Returns timeseries data and all sdk versions.',\n     u'schema': {u'$ref': u'#/definitions/MAUbyCategory',\n                 u'x-scope': ['https://launchdarkly.github.io/ld-openapi/openapi.json']}}", <ValidationError: "{u'description': u'Returns timeseries data and all sdk versions.', u'schema': {u'x-scope': ['https://launchdarkly.github.io/ld-openapi/openapi.json'], u'$ref': u'#/definitions/MAUbyCategory'}} is not valid under any of the given schemas">)

The work around for now is to set validate_swagger_spec = False like this:

from bravado.client import SwaggerClient
OPTS = { 'validate_swagger_spec': False }
client_api = SwaggerClient.from_url(
    'https://launchdarkly.github.io/ld-openapi/openapi.json',
    config=OPTS
)

The error is indicating that the issue is here: a7072c8#diff-8d2741e7ceded60530075c3064376672R71

environment querystring naming

name: environmentKeyQuery

Is this meant to be 'env'? - it appears that is what the api actually expects. when i generate a client with swagger-js and call functions that refer to this, the url used has querystring 'environmentKeyQuery' rather than 'env' eg:

https://app.launchdarkly.com/api/v2/flags/nab/demo-feature?environmentKeyQuery=dev

so at the moment i need to translate this, ie:

        return Swagger({
            spec: json,
            usePromise: true,
            requestInterceptor: req => {
                req.headers.Authorization = API_TOKEN;

                // hack - fix incorrect qs mapping..
                req.url = req.url.replace('environmentKeyQuery', 'env');

                return req;
            }
        });

getUser returns a UserRecord, not a User

From some empirical testing against the live API it appears that the getUser operation ("GET /api/v2/users/project/environment/user_key") returns a UserRecord, not a User.

Can you confirm this is the desired behaviour? If so I'm happy to submit a PR to correct this.

Thanks.

$ref expansion for non-object types

It looks like the problem solved by this script exists elsewhere. An example is #/definitions/CustomRoleKeyOrId

I did some research and it looks like there is no real workaround for v2 of Swagger/OpenAPI. v3 has been released, but there is no built-in generator for many of the platforms this repo is configured to use.

For now I propose expanding all the $refs instead of adding more to the script.

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.