Skip to content

x-required#25

Merged
arcuri82 merged 5 commits intomasterfrom
x-required
Apr 23, 2026
Merged

x-required#25
arcuri82 merged 5 commits intomasterfrom
x-required

Conversation

@arcuri82
Copy link
Copy Markdown
Contributor

Fixed JSON Schema compliance by replacing required with x-required where needed. Added some documentation to explain the issue.

@arcuri82
Copy link
Copy Markdown
Contributor Author

addressing issue #23

@arcuri82
Copy link
Copy Markdown
Contributor Author

Hi @grebnetiew ,

can you review these changes in the auth schema? And then "approve" if you agree, or suggest changes :)

Even if there are no comments, ideally I would prefer not merging changes to the schema unless there is an "explicit" approval from at least one other fuzzer's maintainer

thx!

Copy link
Copy Markdown
Collaborator

@grebnetiew grebnetiew left a comment

Choose a reason for hiding this comment

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

LGTM. I made some suggestions for cleanup and enhancement.

Comment thread src/main/resources/wfc/schemas/auth.yaml
description: "The value of the header"
type: string
required: ["name","value"]
x-required: ["name","value"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a case in which only the name or only the value of a header occurs in a valid spec? I would guess they're very hard to merge if you don't know both values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, in HTTP the name must be there. but, in theory the value could be empty. however, that would be equivalent to an empty string.

shall we remove the "value" from that x-required? I am unsure

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think requiring the value is fine, people who absolutely must have an empty header can use "" as you say. I meant to say that for the headers, we could just use the regular old required without the x-.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah, i see. you are right. would need both anyway, as a merge on an array would not be well-defined otherwise. good point. i ll fix

an auth token from the response payload."
type: boolean
required: ["verb"]
x-required: ["verb"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Now that we aren't constrained to the type of required (array of strings), should we also express the requirement that there must be either endpoint or externalEndpointURL?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

expressing such requirement could be formally done using a oneOf constraint. however, we would end up with same issue that JSON Schema would validate the constraint before the merge :(
or there you think of something like a custom constrain declaration, like x-only-one-of['endpoint','externalEndpointURL']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perhaps we can say that x-required must be an array of string | object, and express it as

x-required:
  - "verb"
  - oneOf: ["endpoint","externalEndpointURL"]

(feel free to refuse if this is the way to madness, because whether we specify this or not, a fuzzer will error out if there is no URL to authenticate with)

Copy link
Copy Markdown
Contributor Author

@arcuri82 arcuri82 Apr 23, 2026

Choose a reason for hiding this comment

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

what about having:

x-required:
  - allOf: ["verb"]
  - oneOf: ["endpoint","externalEndpointURL"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ie, x-required would be either an array of strings (with same semantic of required) or an object (with fields such as allOf and oneOf to express more fine-grained constraints)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Very nice!

@arcuri82 arcuri82 merged commit f707e40 into master Apr 23, 2026
4 checks passed
@arcuri82 arcuri82 deleted the x-required branch April 23, 2026 20:05
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