Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower-case module names #120

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/resource_naming.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ func getModuleFromPath(path string, useParentResourceAsModule bool) string {
if useParentResourceAsModule {
parentPath := getParentPath(path)
parentParts := strings.Split(strings.TrimPrefix(parentPath, pathSeparator), pathSeparator)
return parentParts[len(parentParts)-1]
return strings.ToLower(parentParts[len(parentParts)-1])
}

parts := strings.Split(strings.TrimPrefix(path, pathSeparator), pathSeparator)

// If the first item in parts is not a version number prefix, then
// return as-is.
if !versionRegex.Match([]byte(parts[0])) {
return parts[0]
return strings.ToLower(parts[0])
}

// Otherwise, we should use a versioned module.
return parts[1] + pathSeparator + parts[0]
return strings.ToLower(parts[1]) + pathSeparator + parts[0]
}

func getParentPath(path string) string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/testdata/simple_property_ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ components:
$ref: "#/components/schemas/a_string_prop"

paths:
/v2/fakeresource:
/v2/fakeResource:
post:
operationId: create_fake_resource
requestBody:
Expand Down
Loading