Skip to content

Added validation for duplicate operationId.#192

Open
Aribros wants to merge 4 commits into
cebe:masterfrom
Aribros:Force-Unique-OperationId
Open

Added validation for duplicate operationId.#192
Aribros wants to merge 4 commits into
cebe:masterfrom
Aribros:Force-Unique-OperationId

Conversation

@Aribros

@Aribros Aribros commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Added validation for duplicate operationId.

Fix #181

@Aribros Aribros changed the title Added a failing test Added validation for duplicate operationId. Aug 2, 2023
@charjr

charjr commented Sep 1, 2023

Copy link
Copy Markdown

@Aribros What happens if there are duplicate operationIds in two separate paths?

Unique string used to identify the operation. The id MUST be unique among all operations described in the API.

@Aribros

Aribros commented Sep 8, 2023

Copy link
Copy Markdown
Contributor Author

@Aribros What happens if there are duplicate operationIds in two separate paths?

Unique string used to identify the operation. The id MUST be unique among all operations described in the API.

This has been taken care of. More tests were added to cover duplicate IDs in separate paths .

Comment thread src/spec/Paths.php
$this->_errors[] = "Operation ID '$id', already exist. Operation IDs must be unique.";
$valid = false;
}
$this->_operationsIds[$id] = true;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

_operationsIds should be a local variable otherwise consecutive calls to validate() will report all ids as duplicate.

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.

Duplicate OperationIds should be considered invalid

3 participants