-
Notifications
You must be signed in to change notification settings - Fork 33
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
Choose API mock testing solution #331
Comments
While using the swagger ui, it already has a way to mock the APIs (using the Send Request OR Try it out functionalities). It alerts the user about Cross Origin Reference; so, the dashboard should be white-listed in the umbrella for access. |
@ashakunt Could you take this task? |
Mocking can be done in two ways:
While mocking the GET apis is easy in both the modes, mocking of PUT/DELETE APIs is going to be tricky because in CASE 2, we are actually going to delete the data. |
Based on discussions with @ccsr, @JuusoV and @ashakunt, we decided to use REAL DATA for mocking. So, native swagger implementation should already support the mocking by the "Try it out" or "Send Request" button. We just need to put the CORS (Cross Origin Resource Sharing) policies in place between API Umbrella and Dashboard. One nice way to do this would be (for example in PHP):
Of course, this means that all the requests from Dashboard should have HTTP_ORIGIN set to its own ORIGIN. Alternatively, one could also create a whitelist of HTTP_ORIGIN which have access to the Umbrella. |
Next crucial items are: When the API has WRITE methods like POST, PUT, DELETE, then a user should be alerted before mocking that "this is going to actually change the data on the server". Although, I am not sure, if that is required for MVP (cc: @bajiat ) |
Swagger UI already has an authentication/access control mechanism in-built. There are multiple authentication mechanisms in place, like oauth2, plain http, ftp etc. This can be found by clicking on the slider under the header in the right corner (under the description of the method). We need to figure out how exactly to configure OAuth2 or if at all that is required? |
Did we already have CORS enabled? It would be good to cross check that Swagger's internal mocking actually works. |
@JuusoV can we please have a status update here, based on your recent work/discussions? |
@ashakunt, please follow up on the following CORS related issues in the API Umbrella tracker: |
@ashakunt, can you give a status update on this task? |
@bajiat I need to check a few things and I will provide an update by EOD today. |
I have tested the latest HEAD for mocking of API from the existing documentation (example JSON). It seems to work just fine. |
All the above items are already a part of swagger-ui. Current installed version of api-umbrella is 0.8.0-1 and as per NREL/api-umbrella-gatekeeper@9c275d7, it is a part of https://github.com/NREL/api-umbrella-gatekeeper/releases/tag/v0.8.16 . Hence, after the update is applied to umbrella, this should be solved. |
I also realize that there is a workaround: NREL/api-umbrella-web@e47d6d1 and which is part of release already. So, imho, we are good to go. |
Definition of done
The text was updated successfully, but these errors were encountered: