Skip to content

Conversation

@artem-tkachuk
Copy link
Contributor

@artem-tkachuk artem-tkachuk commented Oct 18, 2025

Fixes-73

What

  • Enhance API spec-based HTTP probing to generate realistic requests from Swagger/OpenAPI
  • Merge path-level and operation-level parameters (op-level overrides)
  • Substitute path params based on schema types (with brace-strip fallback)
  • Build query strings and headers from parameter schemas (JSON-stringify object-typed params)
  • Create JSON request bodies from requestBody schemas and set Content-Type
  • Basic multipart/form-data support (pick first field; retry with image/JSON on 500)
  • Pass aggregated headers into requests

Why

  • More realistic probing exercises more code paths, improving artifact discovery and resulting image quality/size

How Tested

  • Unit tests added in pkg/app/master/probe/http for:
    • path substitution (incl. fallback)
    • query/header generation (object and array handling)
    • param string generation
    • parameter merge/override
  • go test ./pkg/app/master/probe/http -v (all passing)

Notes

…m schemas

Generate realistic requests from OpenAPI/Swagger specs during HTTP probing.
Populate path, query, header and body params using schema info so the probe
exercises more code paths.

Changes:
- Substitute path params based on schema types (with brace-strip fallback)
- Build query strings and headers from parameter schemas
  (JSON-stringify object-typed params)
- Create JSON request bodies from requestBody schemas and set Content-Type
- Basic multipart/form-data support (pick first field, retry with image/JSON on 500)
- Merge path-level and op-level params with op-level override
- Pass a headers map into requests; remove duplicate param collection work
- Add tests for path substitution, query/header generation (object/array),
  param string generation, and param merging

This improves probe coverage without changing existing flags or behavior for
non-API-spec probes.

Fixes: mintoolkit#73
Link: mintoolkit#73

Signed-off-by: Artem Tkachuk <artemtkachuk@yahoo.com>
@artem-tkachuk
Copy link
Contributor Author

@kcq transferred over from slimtoolkit/slim#804 :) Would appreciate your review. Thanks!

@artem-tkachuk artem-tkachuk changed the title http/probe: apispec: generate dummy param data and request bodies fro… http/probe: apispec: generate dummy param data and request bodies Oct 18, 2025
@kcq
Copy link
Contributor

kcq commented Oct 19, 2025

Reviewing

@kcq kcq requested a review from Copilot October 19, 2025 02:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Enhances API spec-based HTTP probing to generate realistic requests from Swagger/OpenAPI definitions, including path/query/header parameter handling and request body generation.

  • Merge path- and operation-level parameters with operation-level overrides
  • Generate dummy values for path/query/header params and JSON bodies; pass headers into requests
  • Update request execution to include generated headers and refined content-type handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/app/master/probe/http/swagger.go Adds parameter merging, path substitution, query/header builders, and updates API call flow to use generated headers and bodies
pkg/app/master/probe/http/swagger_test.go Adds unit tests for path substitution, query/header generation, parameter merging, and schema-to-string conversions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@artem-tkachuk
Copy link
Contributor Author

Feedback from Copilot incorporated

@kcq
Copy link
Contributor

kcq commented Oct 19, 2025

Thanks again for the enhancement @artem-tkachuk ! Let me know if you have cycles for any more enhancements related or unrelated to this openapi spec call generation (for example, one of the potential enhancement could be generating more meaningful data based on the schema properties and data types potentially using fake data creation libraries like https://github.com/brianvoe/gofakeit )

@kcq kcq merged commit ca3e591 into mintoolkit:master Oct 19, 2025
@artem-tkachuk
Copy link
Contributor Author

@kcq of course! Would love to continue contributing to this or anything else really. What's the highest immediate priority that I could try taking on?

@kcq
Copy link
Contributor

kcq commented Oct 19, 2025

@kcq of course! Would love to continue contributing to this or anything else really. What's the highest immediate priority that I could try taking on?

@artem-tkachuk great to hear that you have cycles! The wishlist is pretty extensive :-)

With HTTP probing better form detection and submission logic would be super valuable. There's a little bit of it in the api spec based probe generation logic and there's also the --http-probe-cmd-upload flag. The most important form to detect and to handle properly is login/auth.

Better websocket support is also would be great to have give that some types of app use it extensively. Streamlit applications is a great example of that where a it's necessary to understand low level constructs and to generate the right websocket interactions.

Integrating (and driving) a headless browser (possibly packaged as a container image) has been on the wishlist for a while. This headless browser is necessary to execute javascript client side to generate better application interactions. This is something the built-in crawler and the default http probes don't do.

Lots of other things too including container runtime related enhancements and container/application instrumentation and observability :-) And, of course, feel free to suggest anything that jumps at you.

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