swagger

swagger error “Uncaught RangeError: Invalid string length” in mvc angularjs mix project

浪尽此生 提交于 2020-01-24 22:42:06
问题 I have a project in mvc5 and anguarjs mix and here I am trying to add swagger I had installed the latest Swashbuckle and tried this API which is working http://localhost:6790/swagger/docs/v1 and I could say that my json is valid and checked on https://editor.swagger.io but when I tied this on http://localhost:6790/swagger/ui/index (view) this shows error Uncaught RangeError: Invalid string length at JSON.stringify (<anonymous>) at t.exports.u.getModelSampleJSON (swagger-ui-min-js:formatted

How do you set a custom http client in Bravado?

谁都会走 提交于 2020-01-24 19:14:57
问题 I'm using Bravado 3.0.0. I want to make a request that will use my own custom CA Bundle. The underlying Requests client isn't taking advantage of the REQUESTS_CA_BUNDLE env var I've set. How do I pass in a custom client that uses my CA Bundle? 回答1: (This answer is based on the current-as-of-this-writing 8.1.0 version of Bravado) Since it took me a while to even find this answer while learning about Bravado, and mostly because I think others might benefit when starting out, here's an updated

Cannot reference a component schema defined in a separate file in Swagger

无人久伴 提交于 2020-01-24 15:05:28
问题 I have the following api documentation: swagger: "3.0" info: version: 0.0.1 title: Test API paths: /users: get: summary: Get all registered users produces: - application/json responses: 200: description: Users successfully returned 403: description: User not authorised to call this API schema: $ref: 'components.yaml#/components/schemas/AuthError' Where the AuthError schema is defined in a separate yaml file called components.yaml: components: schemas: AuthError: type: object properties: error

Cannot reference a component schema defined in a separate file in Swagger

荒凉一梦 提交于 2020-01-24 15:05:18
问题 I have the following api documentation: swagger: "3.0" info: version: 0.0.1 title: Test API paths: /users: get: summary: Get all registered users produces: - application/json responses: 200: description: Users successfully returned 403: description: User not authorised to call this API schema: $ref: 'components.yaml#/components/schemas/AuthError' Where the AuthError schema is defined in a separate yaml file called components.yaml: components: schemas: AuthError: type: object properties: error

How to use $ref in swagger file properly while working with swagger-ui-express and swagger-jsdoc

瘦欲@ 提交于 2020-01-24 06:01:11
问题 I started to use swagger with swagger-ui-express and swagger-jsdoc to auto document my existing API, which is written with nodejs and express (like described here - example). I came across a problem when I tried to add a $ref to an existing JSON Schema file (that sits inside my project on the same directory as all my js files) on my annotation. My directory looks like this I tried to write the local path ( ./schema.json ) and the absolute path, tried to use # , using many syntaxes and nothing

Swagger会报AbstractSerializableParameter类的异常问题

淺唱寂寞╮ 提交于 2020-01-23 21:05:45
项目中集成的Swagger每次在访问到页面时总是报AbstractSerializableParameter类的某行代码产生异常,大概内容如下: [nio-1111-exec-4] i.s.m.p.AbstractSerializableParameter : Illegal DefaultValue null for parameter type integer java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_171] 根据报异常的行看了一下源码: @JsonProperty("x-example") public Object getExample() { if (example == null) { return null; } try { if (BaseIntegerProperty.TYPE.equals(type)) { return Long.valueOf(example); } else if (DecimalProperty.TYPE.equals(type)) { return Double.valueOf

Swashbuckle C# swagger plugin how to use my own personal swagger.json by default instead of relying on one it generates?

守給你的承諾、 提交于 2020-01-23 17:13:11
问题 I ran into an issue on a project I am on where for various reasons we were unable to rely on swashbuckle to generate the swagger.json we needed for the project and had to write it ourselves by hand. I have been searching all over the place but have been unable to figure out how to configure it so that when people type /swagger in the home url, it defaults to my swagger.json file instead of the one auto-generated by swashbuckle that will not work for us. Users are forced to manually change to

Swagger+Spring: is it possible to preserve the fields order in the payload?

你。 提交于 2020-01-23 07:38:13
问题 Assuming my payload class is: public class Payload { private final long id; private final String aField; } springfox will sort the payload fields in the lexicographical order which will produce the following payload spec: { "aField": "string", "id": 0 } Is there any control parameter which tells the springfox to preserve the original fields order? 回答1: You may use @ApiModelProperty and specify a position : public class Payload { @ApiModelProperty(value = "The id", position = 1) private final

Django REST Framework Swagger - Authentication Error

冷暖自知 提交于 2020-01-23 06:30:44
问题 I followed the instructions in the docs. So here's my view: from rest_framework.decorators import api_view, renderer_classes from rest_framework import response, schemas from rest_framework_swagger.renderers import OpenAPIRenderer, SwaggerUIRenderer @api_view() @renderer_classes([OpenAPIRenderer, SwaggerUIRenderer]) def schema_view(request): generator = schemas.SchemaGenerator(title='Bookings API') return response.Response(generator.get_schema(request=request)) And I added the following to my

Customize generated model names - Swagger UI

孤街浪徒 提交于 2020-01-23 05:51:12
问题 I'm trying to adjust the "displayName" of the model being used in an automatically generated Swagger definition. This will only affect the Swagger names, meaning the namespace in code would be left untouched, whilst when looking at the model from Swagger UI, you'd see a custom name. Currently, the model name being returned from code is a namespace and looks something like this: b.c.d.e.f , I would like to add an attribute to the code and "mask" the name for the Swagger docs, so that when the