Comments (10)
@whiskeysierra yes, you're right. Switching to int (Integer ?) would probably be the best since only the code is serialized.
Do I PR ?
from problem.
I think 2/ is nicer for the end-user since he gets the status code meaning instantly.
As for maintaining the enum, I think it's not a big deal since we can provide the most commonly used statuses and people who use exotic ones can easily add them in their own code (just like what is done in JAX-RS). They will even enjoy the java8 default methods of the interface (which is not the case with JAX-RS).
I'll do the PR based on 2/ then we can discuss on it if you're OK.
from problem.
It seems to me that only the Status/StatusType classes are used from JAX-RS.
Correct.
This doesn't represent a lot of code so it would be easy to duplicate. Also, it's always nice to remove a dependency and will make the lib smaller.
Yes, but that would be a breaking change. That would at least require that we also do this change in zalando/problem-spring-web.
from problem.
In general I'd be fine with switching from StatusType
to int.
from problem.
Do I PR ?
It would be highly appreciated!
from problem.
Do you prefer Integer (+ static constants) or enum ?
from problem.
I think Integer
without any static constants should be enough. I don't want to maintain a complete list and enum would be too restricting since it needs to be extensible as dictated by the RFC.
from problem.
The reasonPhrase is used in GenericProblems to set the Problem title.
What should I do about it ?
Abou enum extensibility, we can use an interface like StatusType
. So users can add there own status enum by implementing it.
from problem.
The reasonPhrase is used in GenericProblems to set the Problem title.
What should I do about it ?
Good question. Maintaining a list of status code + reason phrases is equivalent to maintaining a complete status enum itself. Something that I'd like to avoid.
Abou enum extensibility, we can use an interface like StatusType. So users can add there own status enum by implementing it.
Yes, that's true. In fact I used JAX-RS for this very reason. And because it contained an enum already that I didn't have to maintain myself.
I'm torn between the following two options:
- a simple int (or Integer), no reason phrase, no enum/dictionary of statuses that we need to maintain
- an interface + an enum of defaults, that introduces a new place where status codes are defined (in addition to JAX-RS, Spring, ...). But you get typed status objects + reason phrases.
I see good arguments for both. Which one do you prefer?
from problem.
I'll do the PR based on 2/ then we can discuss on it if you're OK.
Sounds good!
from problem.
Related Issues (20)
- Compatibility with problem-1.0.1.yaml HOT 1
- Jackson ProblemModule is not registered properly when stacktrace is turned off HOT 5
- Micronaut Problem Integration HOT 2
- Exception handling between API's and between API and Frontend HOT 7
- Incompatibility with Swagger annotations HOT 6
- OffsetDateTime/LocalDateTime serialization not working HOT 5
- wrong name in problem/module-info.java HOT 4
- api-guardian "soft dependency" HOT 7
- Unable to deserialize Problem with Jackson HOT 3
- Unable to create Problem using the ProblemBuilder
- remove stackTrace in error response json HOT 7
- Implement anomaly detection for log in activities HOT 1
- Add a link to RFC 7807 in README HOT 1
- module-info.java is placed in the wrong jar
- Support Jakarta/Spring Boot 3.0 HOT 1
- Spring Framework 6 (Spring Boot 3) support HOT 8
- Possible to identify inheritor in request body without specifying type? HOT 1
- Provide an OpenAPI definition with an according npm library
- Deserialization of AbstractThrowableProblem implementation fails with InvalidTypeIdException HOT 2
- How can I map validation errors?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from problem.