Giter Club home page Giter Club logo

aws-apigateway-swagger-exporter's People

Contributors

isabinin avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

aws-apigateway-swagger-exporter's Issues

Problem forming sub objects in models

The following model JSON schema fails to render correctly. It appears as if the exporting fails to render the sub 'meta' objects properties.

Model Template:

{
  "$schema" : "http://json-schema.org/draft-04/schema#",
  "title" : "Error Schema",
  "type" : "object",
  "properties" : {
    "meta" : {
        "type" : "object",
        "properties" : {
            "code" : { "type" : "integer" },
            "message" : { "type" : "string" },
            "type" : { "type" : "string" }
        }
    },
    "data" : { "type" : "string" }
  }
}

YAML Output:

definitions:
  Error:
    type: "object"
    properties:
      meta:
        type: "object"
      data:
        type: "string"
    description: "This is a default error schema model"

ERROR - Error exporting API in Swagger format

$ sh aws-api-export.sh --api APIName
2017-06-01 09:02:59,056 ERROR - Error exporting API in Swagger format
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z
	at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findDefaultDeserializer(BasicDeserializerFactory.java:1529)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.findStdDeserializer(BeanDeserializerFactory.java:167)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:132)
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:403)
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:352)
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
	at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
	at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:461)
	at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:3838)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3732)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2679)
	at com.amazonaws.internal.config.InternalConfig.loadfrom(InternalConfig.java:236)
	at com.amazonaws.internal.config.InternalConfig.load(InternalConfig.java:249)
	at com.amazonaws.internal.config.InternalConfig$Factory.<clinit>(InternalConfig.java:304)
	at com.amazonaws.util.VersionInfoUtils.userAgent(VersionInfoUtils.java:142)
	at com.amazonaws.util.VersionInfoUtils.initializeUserAgent(VersionInfoUtils.java:137)
	at com.amazonaws.util.VersionInfoUtils.getUserAgent(VersionInfoUtils.java:100)
	at com.amazonaws.ClientConfiguration.<clinit>(ClientConfiguration.java:65)
	at com.bytecodestudio.apigexporter.APIGExporter.export(APIGExporter.java:89)
	at com.bytecodestudio.apigexporter.APIGExporterMain.execute(APIGExporterMain.java:74)
	at com.bytecodestudio.apigexporter.APIGExporterMain.main(APIGExporterMain.java:41)

Using Env Variables for AWS Keys & Temp Token

I tried to run the export command after exporting the aws keys in env variables, but it seems to still get the keys from the credential file. Is it expected? And if so, any plan to support the env variables?

And also the region value.

Path prefix truncated and moved to base path

Using a head build, I exported an API with

basePath: "/"
...

paths:
  /service/{foo-id}
   ...
 /session
   ...

and all the paths were truncated by 3 chars. Perhaps a coincidence they were the 3 chars which were shared across all paths, i.e "/se"

The result became:


basePath: "/se"
...
paths:
  rivice/{foo-id}
...
  ssion/ 

Missing 'parameters' definitions for path parameters

I imported into API Gateway a Swagger definition using your importer tool.
A small snippet of a path ๐Ÿ‘

paths:
  '/service/{cluster-id}':
    parameters:
      - name: 'cluster-id'
        in: path
        type: string
        format: uint64
        required: true
        description: The ID of the cluster as an unsigned long decimal string

    post:
      tags:
        - service
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/registerServiceRequest'
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/registerServiceResponse'
        '406':
          description: Error 406

When its exported using either the AWS Export GUI or your tool the path parameter definitions are gone. I realize there is no direct equivalent in API Gateway (except the Path mapping for HTTP integrations), and there is no schema for them. But I was hoping that an import then export might round trip well enough to be usable.

As it is now paths with /{param} but no parameters declarations dont parse in swagger.
I tried using global parameter defs, path and operation parameters and none show up in the output.

example:
( Note a truncated path -- I will file a separate issue)

paths:
  rvice/{foo-id}:
    post:
      parameters:
      - in: "body"
        name: "body"
        description: "registerFooRequest"
        required: false
        schema:
          type: "object"
          required:
          - "app-token"
          - "timestamp"
          properties:
            app-token:
              type: "string"
              description: "A valid service application token"
            timestamp:
              type: "string"
              format: "date-time"
              description: "The request timestamp"
      responses:
        200:
          description: "registerFooResponse"
          schema:
            $ref: "#/definitions/registerFooResponse"
        406: {}
      x-amazon-apigateway-auth:
        type: "NONE"

NullPointerException APIGExporterMain.java:34

Throwing a NullPointerException.

Exception:

$ ./aws-api-export.sh --api XXXXXX
2015-12-09 20:02:38,748 ERROR - Error exporting API in Swagger format
java.lang.NullPointerException
    at com.bytecodestudio.apigexporter.APIGExporter.getResponseHeaders(APIGExporter.java:274)
    at com.bytecodestudio.apigexporter.APIGExporter.export(APIGExporter.java:141)
    at com.bytecodestudio.apigexporter.APIGExporterMain.execute(APIGExporterMain.java:59)
    at com.bytecodestudio.apigexporter.APIGExporterMain.main(APIGExporterMain.java:34)

Env:

$ java -version
java version "1.7.0_91"
OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)

$ aws --version
aws-cli/1.9.12 Python/2.7.6 Linux/3.16.0-46-generic botocore/1.3.12

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"

$ uname -a
Linux ****** 3.16.0-46-generic #62~14.04.1-Ubuntu SMP Tue Aug 11 16:27:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

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.