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

[NOT A BUG -> QUESTION] how to set fix path variables #2454

Closed
tibeer opened this issue Jan 25, 2024 · 2 comments
Closed

[NOT A BUG -> QUESTION] how to set fix path variables #2454

tibeer opened this issue Jan 25, 2024 · 2 comments

Comments

@tibeer
Copy link

tibeer commented Jan 25, 2024

I have a swagger file that looks like this:

swagger: '2.0'
(...)
paths:
  /{compartment}/person:
    get:
        - name: compartment
          in: path
          description: >-
            Foo
          required: true
          type: string
          maxLength: 11
         (...)
  /{compartment}/person/{id}:
    get:
        - name: compartment
          in: path
          description: >-
            Foo
          required: true
          type: string
          maxLength: 11
         (...)
  /{compartment}/person/{id}/main_address:
    get:
        - name: compartment
          in: path
          description: >-
            Foo
          required: true
          type: string
          maxLength: 11
         (...)

Actually there are approx. 500 calls inside this file, all using more or less the variables compartment and id.
How to I set the variables to a fixed value so the path is consistent?

At them moment they get populated with a random value for every endpoint:

[8:25:00 AM] › [CLI] …  awaiting  Starting Prism…
[8:25:10 AM] › [CLI] ℹ  info      GET        http://0.0.0.0:4010/eaque/person
[8:25:10 AM] › [CLI] ℹ  info      GET        http://0.0.0.0:4010/vel/person/6552
[8:25:10 AM] › [CLI] ℹ  info      GET        http://0.0.0.0:4010/molestiae/person/3563445/main_address

How to get an output that looks like this?

[8:25:00 AM] › [CLI] …  awaiting  Starting Prism…
[8:25:10 AM] › [CLI] ℹ  info      GET        http://0.0.0.0:4010/space_3/person
[8:25:10 AM] › [CLI] ℹ  info      GET        http://0.0.0.0:4010/space_3/person/9952
[8:25:10 AM] › [CLI] ℹ  info      GET        http://0.0.0.0:4010/space_3/person/9952/main_address

Background:

  • I received that swagger file and do not have control over its content
  • I am in charge to connect these APIs to our product
  • We will loose access to this API after a certain amount of time -> therefore I would like to have a mock service
@chohmann
Copy link
Contributor

@tibeer we do not support the functionality you're describing today. However, the values printed out at prism start up are just valid examples of URLs you can send requests to. Those aren't the only URLs that will work for Prism to mock. So just because Prism prints out http://0.0.0.0:4010/eaque/person as an example, you can send it http://0.0.0.0:4010/space_3/person as you'd like and Prism will still mock it since the value for compartment matches the OAS spec. We're hoping that's all you need for your use case and Prism does not need this functionality you described just to show uniform example URLs.

@tibeer
Copy link
Author

tibeer commented Jan 27, 2024

Awesome! That information helped a lot, thanks! :)

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

No branches or pull requests

2 participants