We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working some more with this and related libraries I'm repeatedly thinking whether the ProblemDocument really needs to be a class?
ProblemDocument
Wouldn't it be enough to simply define a contract for a problem document and have mapper return plain objects?
interface ProblemDocument extends Record<string, unknown> { detail?: string; instance?: string; status: number; title: string; type?: string; } class Mapper { mapError(error): ProblemDocument { return { status: 500, title: 'Something happened' } } }
This would simplify how extensions are implemented and make it easier to work with derived or decorated mappers
The text was updated successfully, but these errors were encountered:
And as alternative to the Record<> type, we could keep a closed interface and have consumers extend with module augmentation
Record<>
declare module 'http-problem-details' { interface ProblemDocument { extendingField?: string[] } }
Sorry, something went wrong.
Please send a PR.
Definitely, will do.
No branches or pull requests
Working some more with this and related libraries I'm repeatedly thinking whether the
ProblemDocument
really needs to be a class?Wouldn't it be enough to simply define a contract for a problem document and have mapper return plain objects?
This would simplify how extensions are implemented and make it easier to work with derived or decorated mappers
The text was updated successfully, but these errors were encountered: