Open yasirub opened 1 year ago
Hi @yasirub I don't think proprietary extension would fit with the code of the library as we would have to map them all.
With that said, extension support should be currently available on the main branch thanks to this PR. I think that with the next version tag you should be able to define the extensions you need yourself :)
It's already released with 0.9.0. You can see the example usage in this test: https://github.com/davidebianchi/gswagger/blob/e4154d1870a36a0ab3d630647444304f3169e527/route_test.go#L455-L469
@fredmaggiowski by source code i meant my project's code. @davidebianchi I think what you mentioned is what i was looking for. I will try it and see.
Sounds great
Hi, extensions worked and I was able to generate spec.
paths:
/users:
get:
responses:
'200':
content:
application/json:
schema:
items:
additionalProperties: false
properties:
address:
title: user address
type: string
groups:
default:
- users
items:
type: string
title: groups of the user
type: array
name:
example: Jane
title: The user name
type: string
phone:
title: mobile number of user
type: integer
required:
- name
- phone
- address
type: object
type: array
description: ''
x-amazon-apigateway-integration:
connectionId: $${stageVariables.dev_vpc_link}
connectionType: VPC_LINK
httpMethod: GET
type: http
uri: http://gosvc-tenant-management.elb.eu-central-1.amazonaws.com/tenants/
But I would like if there is way to sperate out schemas into component section and add a ref to it, like below
components:
schemas:
user:
items:
additionalProperties: false
properties:
address:
title: user address
type: string
groups:
default:
- users
items:
type: string
title: groups of the user
type: array
name:
example: Jane
title: The user name
type: string
phone:
title: mobile number of user
type: integer
required:
- name
- phone
- address
type: object
type: array
paths:
/users:
get:
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/user'
description: ' '
x-amazon-apigateway-integration:
connectionId: $${stageVariables.dev_vpc_link}
connectionType: VPC_LINK
httpMethod: GET
type: http
uri: http://gosvc-tenant-management.elb.eu-central-1.amazonaws.com/tenants/```
is there a way to do this?
Ad the moment, it is only possible manually using the AddRawRoute
method. With this, it is possible to write the spec on your own.
We could see to add support to components in the future.
Hi, Is there any way to add these https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions.html extensions to the source code, so that generated API spec will have these extensions