swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

refactor: createRef and parseRef with Improved Error Handling and Validation

Open gwagjiug opened this issue 8 months ago • 2 comments

PR Description

Changes

  1. Refactored createRef and parseRef functions:

Added validation to ensure createRef accepts an array and is not empty.

Improved error handling for parseRef to check if the reference string starts with #/.

  1. Error Handling:

Both functions now throw detailed error messages when invalid inputs are provided, making debugging easier.

Why is this change needed?

The validation ensures the functions behave correctly, providing meaningful feedback when invalid input is passed.

This change improves the robustness of the SchemaComponentsMap class and provides better developer experience by catching errors earlier.

gwagjiug avatar Apr 16 '25 07:04 gwagjiug