Giter Club home page Giter Club logo

Comments (3)

outofcoffee avatar outofcoffee commented on May 26, 2024

Hi @jeanloop, thanks very much for getting in touch!

Do you have an example before/after JSON you could share that reproduces the issue?

Also, please could you let me know the version of swagger UI you’re using; is it the embedded one? If so, this was updated in the latest beta, so would be keen to see if it’s still an issue.

from imposter.

jeanloop avatar jeanloop commented on May 26, 2024

Hi @outofcoffee,

sorry for the delay, I didn't find the time to setup a simple test case until today.

So here it is:

Simply unzip the attached file into a folder, cd into it on the command line and run:
docker run --rm -ti -p 8080:8080 -v $(pwd)/:/opt/imposter/config outofcoffee/imposter-openapi

I used the OAS3 spec from the examples here: https://raw.githubusercontent.com/outofcoffee/imposter/master/plugin/openapi/src/test/resources/config/openapi3-with-examples.yaml

The only change: I added a securityScheme definition for a bearer token and configured security for all endpoints.

When you run it and look at the swagger UI, click on the "authenticate" button above the list of endpoints. The window will open but does not show any content. It should show an interface to login by providing a token.

When you look at the combined.json produced by the server, you may notice, that the components/securitySchemes definition is now included, but the letter case of the type-property has changed from lowercase to uppercase. Swagger UI does not like that. I tested it by filtering combined.json using a regular expression before it is sent by the server. When using lowercase values, all is fine.

The same problem occurs when defining parameters using the style-property. There may be other properties with the same issue that I did not use yet.

Since the OAS documentation defines those values as lowercase, I think that swagger UI is behaving correctly. See here for example: https://swagger.io/docs/specification/authentication/bearer-authentication/

I debugged the imposter java code a bit trying to find the source of the problem and I think it may be related to this file: https://github.com/outofcoffee/imposter/blob/master/core/src/main/groovy/com/gatehill/imposter/util/MapUtil.java.

Hope this helps identifying the problem.

Thanks again for this great tool!

impostertest.zip

from imposter.

outofcoffee avatar outofcoffee commented on May 26, 2024

Thank you for the really comprehensive bug report and description. This helped immensely in tracking down this bug. It is finally fixed in 4928932, released in v2.2.0.

from imposter.

Related Issues (20)

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.