api-problem icon indicating copy to clipboard operation
api-problem copied to clipboard

Interface for RFC specific field members

Open leroy0211 opened this issue 4 years ago • 2 comments

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

An additional interface with some getters for the RFC specific field members (chapter 3.1) would be very nice to have.

I have often mistyped on those fields. Some interface which let a developer implement specific methods to be strict about it would be great.

Just of the top of my head...

interface StrictApiProblemInterface
{
    public function getType(): ?string
    public function getTitle(): string
    public function getStatus(): ?int
    public function getDetail(): ?string
    public function getExtensions(): array
}

leroy0211 avatar Feb 24 '21 15:02 leroy0211

Yeah that could make sense to provide. Want to give it a shot?

veewee avatar Feb 24 '21 17:02 veewee

hey! why get*() we are not in context of setting properties from a DTO instance. my thoughts

interface StrictApiProblem 
{
    public function type(): ?string
    public function title(): string
    public function status(): ?int 
    public function detail(): ?string
}

interface UnstrictApiProblems
{
    // nothing found about approach how to declare multiple problems, see violation or another wording is not described on rfc
    public function problems(): ?array
}

olekhy avatar Jul 28 '21 08:07 olekhy