softwaremill / softwaremill/tapir

[Suggestion]: add Play Json support for Openapi spec

Open
#3,338 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.5k
Forks
468
Avg merge
5h 37m
Merged PRs (30d)
34

Description

I use Play Json library in my project.
Swagger (OpenAPI) supports both YAML and JSON formats for their spec files.
Hence, I do not necessarily need to import Circe into my project, if there is a possibility to generate spec-files as JSON (instead of YAML) using predefined Play JSON encoders.

So I wanted to suggest to create a PR in https://github.com/softwaremill/sttp-apispec with a new sub-package openapi-play-json with Play JSON encoders for all the model-types. This way I could generate the Openapi spec in JSON format and remove the dependency on Circe.

But I've noticed that at the moment tapir-openapi-docs package in this repo depends on Circe, so even if drop/replace openapi-circe-yaml in my build.sbt - still it will be pulled as an indirect dependency.
Although I could not find any imports of Circe in the scala code of tapir-openapi-docs - does this package really depends on Circe, or can it be dropped? If I guess correctly, it was probably added just for convenience, so that devs need to explicitly import one lib instead of two libs. If that's the case, then maybe we could create a new meta-package tapir-openapi-docs-circe which merges tapir-openapi-docs with openapi-circe-yaml. Or just mention in docs that two libs need to be installed.

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 by reviewing the proposed openapi-play-json sub-package in the sttp-apispec repository and the tapir-openapi-docs dependency in build.sbt. Compare the existing openapi-circe-yaml integration with the requested Play JSON encoders for all model types. Done means OpenAPI specifications can be generated as JSON using Play JSON without requiring Circe.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.