Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swagger & api & swagger ui #5

Open
xgqfrms opened this issue Oct 18, 2018 · 11 comments
Open

swagger & api & swagger ui #5

xgqfrms opened this issue Oct 18, 2018 · 11 comments
Labels
bug enhancement Error: Response validation failed Error: Response validation failed: failed schema validation help wanted question swagger & api & swagger ui swagger & api & swagger ui swagger api swagger api swagger node swagger node yaml & bug yaml & bug

Comments

@xgqfrms
Copy link
Owner

xgqfrms commented Oct 18, 2018

swagger & api & swagger ui

https://www.cnblogs.com/xgqfrms/p/9808520.html

@xgqfrms xgqfrms added the swagger & api & swagger ui swagger & api & swagger ui label Oct 18, 2018
Repository owner locked and limited conversation to collaborators Oct 18, 2018
@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

error

bug

Error initializing middleware
Error: Swagger document(s) failed validation so the server cannot start

swagger-api/swagger-node#354

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

- & yaml bug

missing - symbol bug

image

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

Error

image

http://localhost:8080/users?user=xgqfrms

{
    "message": "Cannot read property 'value' of undefined"
}

http://localhost:8080/users?name=xgqfrms

{
    "message": "Cannot read property 'value' of undefined"
}

OK

image

http://127.0.0.1:8080/hello?name=xgqfrms

{
    "message": "Hello, xgqfrms!"
}

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

OK

object

image

Error

undefined ??? in-valid

image

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

image
image

image

Error: Response validation failed: failed schema validation

https://github.com/swagger-api

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

bug ???

swagger-api/swagger-node#578

@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

solution

why ???

image

modify config default.yaml

   validateResponse: false
# swagger configuration file

# values in the swagger hash are system configuration for swagger-node
swagger:

  fittingsDirs: [ api/fittings ]
  defaultPipe: null
  swaggerControllerPipe: swagger_controllers  # defines the standard processing pipe for controllers

  # values defined in the bagpipes key are the bagpipes pipes and fittings definitions
  # (see https://github.com/apigee-127/bagpipes)
  bagpipes:

    _router:
      name: swagger_router
      mockMode: false
      mockControllersDirs: [api/mocks]
      controllersDirs: [api/controllers]

    _swagger_validate:
      name: swagger_validator
      validateResponse: false
      # validateResponse: true

    # pipe for all swagger-node controllers
    swagger_controllers:
      - onError: json_error_handler
      - cors
      - swagger_security
      - _swagger_validate
      - express_compatibility
      - _router

    # pipe to serve swagger (endpoint is in swagger.yaml)
    swagger_raw:
      name: swagger_raw

# any other values in this file are just loaded into the config for application access...

@xgqfrms xgqfrms added the Error: Response validation failed Error: Response validation failed: failed schema validation label Oct 18, 2018
@xgqfrms
Copy link
Owner Author

xgqfrms commented Oct 18, 2018

// http://localhost:8080/users?user=xgqfrms

{
    "users": "Hello, xgqfrms!"
}

// http://localhost:8080/users?name=xgqfrms

{
    "users": "Hello, stranger!"
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug enhancement Error: Response validation failed Error: Response validation failed: failed schema validation help wanted question swagger & api & swagger ui swagger & api & swagger ui swagger api swagger api swagger node swagger node yaml & bug yaml & bug
Projects
None yet
Development

No branches or pull requests

1 participant