swagger-api / swagger-api/swagger-codegen

[R] code generator should support S4 classes

Open
#9,333 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hi,
currently the templates for R code generation use R6Class to keep the object model:
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/r/model.mustache

#' @export
{{classname}} <- R6::R6Class(  '{{classname}}', public = list(...)

Projects like the bioconductor.org world prefer S4 classes among their packages,
and following that (strong) recommendation helps to maintain interoperability between
the packages.

So the enhancement would be to (also) have the possibility to create
the object hierarchy as S4 classes. @nilshoffmann has a project
that uses swagger and wants S4 classes to be emitted.

Swagger-codegen version

master is currently 2.4.4

Labels suggested are:
client:R and enhancement:feature or enhancement:code format.

Yours, Steffen

Contributor guide

Open the contributing guide

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 modules/swagger-codegen/src/main/resources/r/model.mustache and compare the requested S4 object hierarchy with the current R6 output. Done means R code generation can emit S4 classes as an option while keeping the existing R6 generation available.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.