swagger-api / swagger-api/swagger-ui

$uuid and fn.js

Open
#8,171 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Hello.
After trying to use swashbuckle's swagger version in net 6 I noticed the uuid fields in the sample requests are all generated using"3fa85f64-5717-4562-b3fc-2c963f66afa6" and can see that this is from this repository's client javascript functionality.
Is there anyway this could be made random every time the execute function is called?
Or perhaps some sort of functionality to enable this could be added. If not has anyone successfully randomized this using swashckbuckle?
const primitives = {
"string": (schema) => schema.pattern ? generateStringFromRegex(schema.pattern) : "string",
"string_email": () => "user@example.com",
"string_date-time": () => new Date().toISOString(),
"string_date": () => new Date().toISOString().substring(0, 10),
"string_uuid": () => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"string_hostname": () => "example.com",
"string_ipv4": () => "198.51.100.42",
"string_ipv6": () => "2001:0db8:5b96:0000:0000:426f:8e17:642a",
"number": () => 0,
"number_float": () => 0.0,
"integer": () => 0,
"boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the client JavaScript functionality containing the primitives object, especially the string_uuid generator, and trace how it is used when execute is called. Confirm that UUID sample values are regenerated on each execute call and verify the behavior with the relevant existing client checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.