lhns / lhns/scala-http-problem

Custom problem examples with tapir

Open
#78 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Scala
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Currently this library hardcodes single example value equal to each problem definition.

This is problematic since returned problem must fully match one of declared problems (as per isTemplateOf) so it's actually impossible to add real example of variable data.

Not quite sure what the API would look like for this, perhaps something like

case class HttpProblemWithExamples(problem: HttpProblem, examples: List[Example[HttpProblem]])

def httpProblems(problemTemplates: HttpProblemWithExamples*)

Hopefully there is a less ugly solution.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tapir/src/main/scala/de/lhns/httpproblem/tapir/json.scala at line 55 and core/src/main/scala/de/lhns/httpproblem/HttpProblem.scala at lines 52–58. Trace how examples are generated and validated by isTemplateOf, then define an API for variable custom examples that still matches declared problems. Done means callers can provide real examples without the current hardcoded values.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.