Raw Property Name Support — Test Design

Convert raw OpenAPI property names into valid C# identifiers with keyword escaping.

413|64|Updated Feb 7, 2023
One-click install
npx skills add https://github.com/christianhelle/refitter --skill raw-property-name-support-test-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Raw Property Name Support — Test Design
Source: https://github.com/christianhelle/refitter/tree/main/.squad/skills/raw-property-names
Command: npx skills add https://github.com/christianhelle/refitter --skill raw-property-name-support-test-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures raw OpenAPI property names can be safely converted into valid C# identifiers, preventing compile-time errors and preserving correct JSON mappings.

Core Features & Use Cases

  • Validate and sanitize OpenAPI property names so generated code uses valid C# identifiers.
  • Preserve valid original names in code when possible, while escaping reserved keywords with @.
  • Use cases include code generation for clients from OpenAPI specs with snake_case, kebab-case, or non-identifier field names.

Quick Start

Analyze an OpenAPI spec containing raw property names like payMethod_SumBank and verify generated C# identifiers compile and deserialize correctly.

Frequently Asked Questions about Raw Property Name Support — Test Design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate valid C# identifiers from OpenAPI property names with snake_case or spaces?

OpenAPI property names containing snake_case, kebab-case, or spaces are sanitized into valid C# identifiers by removing invalid characters and applying specific formatting rules. This prevents compile-time errors while preserving the original JSON serialization mappings.

How does C# code generation handle OpenAPI reserved keywords?

OpenAPI reserved keywords are handled during C# code generation by escaping them with the @ prefix, such as @class or @event. This ensures the generated code compiles correctly while accurately tracking the original property name for JSON deserialization.

Why does my generated C# client fail to deserialize JSON from an OpenAPI spec?

Generated C# clients fail to deserialize JSON when raw OpenAPI property names are not properly mapped to valid C# identifiers. Sanitizing invalid characters and escaping keywords ensures the generated code preserves the correct JSON mappings needed for successful deserialization.

What is the best way to sanitize invalid characters in OpenAPI property names for C#?

The best way to sanitize invalid characters in OpenAPI property names for C# is to apply identifier sanitization rules that strip or replace unsupported characters while preserving valid original names. Escaping reserved keywords with @ is also enforced to guarantee compilation.

Does OpenAPI code generation preserve valid C# identifier names?

OpenAPI code generation preserves valid C# identifier names whenever possible during the conversion process. If the original property name is already a valid identifier, it remains unchanged to maintain consistency between the OpenAPI spec and the generated C# code.