Skip to content

Commit

Permalink
Keep all caps class names for schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
walsha2 committed Aug 27, 2023
1 parent 39fe3bb commit 7cddacf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.4.11

* Keep all caps class names in schema generation

## 0.4.10

* Better handling of whitespace in schema generation
Expand Down
8 changes: 7 additions & 1 deletion lib/src/generators/schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ class SchemaGenerator extends BaseGenerator {
// Loop through all the schemas and write
for (final s in schemas.keys) {
final filename = s.snakeCase.replaceAll(RegExp(r'(?<=\w)_(?=\w_)'), '');
String name = s.pascalCase;
String name;
if (s == s.toUpperCase()) {
// Do not modify all uppercase schema names
name = s;
} else {
name = s.pascalCase;
}

if (options.onSchemaName != null) {
final userSchemaName = options.onSchemaName!(name);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: openapi_spec
description: OpenAPI Specification generator using native Dart code, as well as an all-in-one parser of existing specifications.
version: 0.4.10
version: 0.4.11
maintainer: Taza Technology LLC
repository: https://github.com/tazatechnology/openapi_spec
issue_tracker: https://github.com/tazatechnology/openapi_spec/issues
Expand Down

0 comments on commit 7cddacf

Please sign in to comment.