Ideas

Include enum names in the REST API v2 OpenAPI spec

Note You are not authorized to edit this feature.

Include enum names in the REST API v2 OpenAPI spec

API

The REST API v2 OpenAPI document (/api/v2/doc) describes every enum as a bare list of integers with no names. Generating a typed client from the spec (NSwag, Kiota, OpenAPI Generator) therefore produces enums whose members are _0, _1, _2 and so on. Where an enum has two names for the same value (for example GroupType.AttendanceRule), the generated code has a duplicate member and doesn't compile.


We checked against Rock 19.8.1. The spec has about 220 inline enums and none of them carries names. The v1 Swagger configuration calls DescribeAllEnumsAsStrings() (Rock.Rest/Swagger/SwaggerConfig.cs); the v2 configuration (SwaggerConfigV2.cs) has nothing equivalent.


Suggested change: add a schema filter to the v2 Swagger configuration that adds an x-enumNames list (the member names, in the same order as the values) to each enum schema. The wire format stays integers, so nothing changes for existing API callers. Client generators read x-enumNames and produce properly named enums. The change is small and confined to Rock.Rest/Swagger.


Why it matters: v2 is the current API, and Rock.Client.dll hasn't been regenerated since early 2025, so generating models from the v2 spec is the natural way for a .NET integration to stay current with each Rock release. Named enums are the one piece the spec is missing for that.


We're happy to submit a pull request for this if the core team agrees with the approach.


Geoffrey Roberts,
Saddleback Church

Photo of Geoffrey RobertsSubmitted by Geoffrey Roberts, Saddleback Church  ·   ·  API
Login to add a comment...

Submission Success Tips

Cultivate your ideas for maximum impact with these helpful submission tips that will increase the chances of your brilliant concepts becoming reality.

  • Clear Title: Craft a straightforward and descriptive title that instantly conveys the essence of your idea.
  • Concise Description: Provide an idea description that is succinct, ensuring it effectively communicates the concept without unnecessary verbosity.
  • Provide Additional Details: With a concise description complete, now provide any other details that are needed to better understand the requirements.
  • Thorough Ministry Need Review: Provide a comprehensive overview of the ministry need your idea addresses, emphasizing its significance.
  • Cover the WHY: Clearly articulate the rationale behind your idea, explaining why it's essential and how it aligns with the organization's goals and mission. Oftentimes a clear "why" sheds light into other possible options.