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

Support baseURL for Stub Server #1431

Open
harikrishnan83 opened this issue Nov 16, 2024 · 6 comments
Open

Support baseURL for Stub Server #1431

harikrishnan83 opened this issue Nov 16, 2024 · 6 comments
Assignees
Labels
feature_request New feature

Comments

@harikrishnan83
Copy link
Member

Is your feature request related to a problem? Please describe.
Many a times, the API path needs to be prefixed with additional path segments. Example: /products needs to be prefixed with /api/store/.

Describe the solution you'd like
Support either both or at least one capability.

  • Support baseURL similar to testBaseURL for stub server
  • Pick it up from servers section

Additional context
Creating this on behalf of @twinkle12b as a follow-up to issue #1425

@twinkle12b
Copy link

Hello thanks for opening this request, can you help me resolve the issue of how can I also do this for my stub server as it is also not able to detect the server url path, like i can set system property for testbaseurl base path for contract as test. How can i do this for stub server basepath

@twinkle12b
Copy link

Hey @harikrishnan83 @samyakOO7 any updates on the question???

@harikrishnan83
Copy link
Member Author

hello @twinkle12b, thanks for following up on this.

We are already working on option 1 "Support baseURL similar to testBaseURL for stub server" mentioned above. And should be available shortly.

Meanwhile on option 2 "Pick it up from servers section", the servers section in OpenAPI 3.0.x, as you may be aware, can have multiple servers.

servers:
  - url: https://api.production.example.com/v1
    description: Production server
  - url: https://api.staging.example.com/v1
    description: Staging server
  - url: http://localhost:8080/v1
    description: Local development server

So to pick one of them we plan to use description field as the identifier for the URL. So the syntax may look something like specmatic test --server "Local development server" or specmatic virtualize/stub --server "Local development server". Any thoughts on this?

Thanks.

cc @samyakOO7

@twinkle12b
Copy link

Hi @samyakOO7 how can i do this programmatically like via some system property, as i running test class and not command line

@harikrishnan83
Copy link
Member Author

hello @twinkle12b, we will update our documentation and share the link with you as soon as this is available shortly. Thanks.

@GagandeepSharma060
Copy link

@harikrishnan83 Not sure if this is the right place to ask this question. Does it mean that we can have the baseUrl for API tests defined at the fine (spec) level and we can have multiple files with multiple hosts running in the same suite?

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

No branches or pull requests

4 participants