swagger-api / swagger-api/swagger-codegen

[R] Enums are not supported

Open
#6,616 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: R Enhancement: Feature Feature: Enum help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Models that are enum classes are not being generated correctly, they are missing allowable values from the swagger specs.

How should enums be implemented since R doesn't support it?

Here's one solution:
enumClass <- R6::R6Class(
'ElevationLevel',
type1 = "TYPE_1",
type2 = "TYPE_2",
type3 = "TYPE_3",
value = NULL
public = list(
initialize = function(value){
self$value <- value
}
)
)

@ramnov @wing328

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 by locating the R model-generation templates and the logic that maps enum classes to allowable values in the Swagger specification. Review the proposed R6 representation and existing generated-model behavior; done means enum models are generated correctly and their allowable values appear in the specs.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.