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

Demonstrate Microcks Mocking #21

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Demonstrate Microcks Mocking #21

wants to merge 9 commits into from

Conversation

philsturgeon
Copy link
Collaborator

@philsturgeon philsturgeon commented Jun 26, 2024

This branch aims to get the Train Travel API working with Microcks as smoothly as possible, with good dynamic responses and minimal errors showing up in the Spectral ruleset.

Copy link

github-actions bot commented Jun 26, 2024

🤖 API structural change detected:

Modified (1)

  • GET /stations
    • Response modified: 200
      • Content type modified: application/json
        • Property added: links

Preview documentation

Powered by Bump.sh

@philsturgeon philsturgeon changed the title getting examples working with microcks Demonstrate Microcks Mocking Jul 25, 2024
@philsturgeon
Copy link
Collaborator Author

philsturgeon commented Nov 5, 2024

@paulRbr @scharrier I have updated the microcks pull request as it had a few unrelated changes, so you can clearly see what needs to be done in order for a OpenAPI to work with both Bump.sh and Microcks.

Microcks currently requires a) named examples, and b) variables in the response examples in order to reuse request parameters.

The names examples show up the same as usual, but they do make the OpenAPI a little more clunky.

image

The variables in the response show up literally in Bump.sh and this of course makes no sense to the user.

Screenshot 2024-11-05 at 1 56 03 PM

So, questions:

  1. Are we ok with the Train Travel API using this slightly more clunky OpenAPI for named examples? If not... I had mentioned to Microcks about supporting single example instead of only working with named pairs, but named pairs can be very powerful if used correctly. If we need Microcks to roll out a new feature before pushing collaboration this could be a blocker.

  2. Are we ok with the Train Travel API demo showing these variables in there, or should we try and avoid that somehow.

  • A. Bump.sh Docs adds functionality to reuse values from the request to populate those variables and make for a heck of a powerful feature nobody else currently has.
  • B. We use overlays to add these examples and have a second Microcks-enabled OpenAPI document that is hosted elsewhere, which we then make available for the microcks team to pull in.

Probably B, I thought of that mid writing this all out. 😆

Still, thoughts on this would be welcome when you have a moment.

@@ -24,6 +24,11 @@ info:
servers:
- url: https://api.example.com
description: Production
x-internal: false

- url: https://mocks.example.com/rest
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we manage to get a hosted microcks instance up and running I'd like to update this to point there. @lbroudoux

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have a ready to use / managed instance for hosting the Train Travel API => https://try.microcks.io using guest/guest. I don't have communicate on this yet but can already have a look (even if the API is not yet loaded in)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a look and its really cool. When we get the TT API into it I will update this.

@lbroudoux
Copy link

Are we ok with the Train Travel API using this slightly more clunky OpenAPI for named examples? If not... I had mentioned to Microcks about supporting single example instead of only working with named pairs, but named pairs can be very powerful if used correctly. If we need Microcks to roll out a new feature before pushing collaboration this could be a blocker.

I tried this after our conversation but relying on single default example raise a lot of other question in the case of multiple response codes, response formats and so on. It works with very basic API (1 input/1 output) but doesn't work with realistic ones.

B. We use overlays to add these examples and have a second Microcks-enabled OpenAPI document that is hosted elsewhere, which we then make available for the microcks team to pull in.

This is definitely possible to move those "advanced" examples using expressions into another OpenAPI file. APIVersion your declare on the Microcks Hub can reference many artifacts and these ones will be merged during the import. So expressions won't "pollute" the OpenAPI spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants