Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4976
Closed
Open
Issue created Jan 11, 2020 by Jim Schubert@jimschubertContributor

[REQ] Standardize vendor extension naming conventions

Is your feature request related to a problem? Please describe.

Vendor extensions are not intuitive, and are case sensitive. They're also not fully documented on the wiki at https://github.com/OpenAPITools/openapi-generator/wiki/Vendor-Extensions

Describe the solution you'd like

  • We should standardize this to avoid confusion, probably kebab lower case (x-objc-operationid rather than x-objc-operationId).
  • We may want to require that all words are separated by hyphen (x-objc-operation-id rather than x-objc-operationid).

Describe alternatives you've considered

none

Additional context

The issue is apparent in a vendor extension such as x-mysqlSchema. If someone mistakenly defines this as x-mysql-schema or x-mysqlschema, the configuration will not be accepted. However, if we normalize from the current x-mysqlSchema to kebab-cased then lower-case this, the result is x-mysql-schema.

Test examples:

@Test
public void testVendorExtensionConventionConversion(){
    String input = "x-mysqlSchema";
    CaseFormat formatter = CaseFormat.LOWER_CAMEL;
    String output = formatter.converterTo(CaseFormat.LOWER_HYPHEN).convert(input);
    Assert.assertEquals(output, "x-mysql-schema");
}
@Test
public void testVendorExtensionConventionNoop(){
    String input = "x-mysql-schema";
    CaseFormat formatter = CaseFormat.LOWER_CAMEL;
    String output = formatter.converterTo(CaseFormat.LOWER_HYPHEN).convert(input);
    Assert.assertEquals(output, "x-mysql-schema");
}
@Test
public void testVendorExtensionUnknown(){
    String input = "x-mySQLSchema";
    List<String> supportedVendorExtensions = Arrays.asList("x-mysql-schema");
    CaseFormat formatter = CaseFormat.LOWER_CAMEL;
    String output = formatter.converterTo(CaseFormat.LOWER_HYPHEN).convert(input);
    // In implementation, we'd want to log a warning.
    Assert.assertFalse(supportedVendorExtensions.contains(output), "Invalid vendor extension should fail.");
}

We could easily make the change in 5.0 and maintain currently documented extensions. We'd want to wait for 5.0, though, because templates will need to be updated to lower cased vendor extensions.

Assignee
Assign to
Time tracking