Skip to content

Commit f5af619

Browse files
feat: add UpperCamelCase aliases for remaining access and input types (#1920)
On-behalf-of: Gerald Morrison (SAP) <gerald.morrison@sap.com> <!-- markdownlint-disable MD041 --> #### What this PR does / why we need it Completes the UpperCamelCase type alias registration started in #1881. That PR covered helm, localBlob, ociBlob (access) and dir, file, helm, utf8 (input) but missed several access methods and input types. This PR adds UpperCamelCase aliases for all remaining types: **Access methods:** - `gitHub` → alias `GitHub` / `GitHub/v1` - `npm` → alias `NPM` / `NPM/v1` - `wget` → alias `Wget` / `Wget/v1` - `git` → alias `Git` / `Git/v1alpha1` - `maven` → alias `Maven` / `Maven/v1` **Input types (CLI):** - `git` → alias `Git` - `maven` → alias `Maven` - `npm` → alias `NPM` - `wget` → alias `Wget` No behavior change: all existing lowercase type strings continue to work. The new aliases ensure components authored with the new `open-component-model` monorepo bindings (which emit UpperCamelCase as primary) can be read by this legacy CLI. Note: `NPM` follows the acronym convention used by `OCIImage`, `UTF8`, etc. **Documentation:** UpperCamelCase aliases are registered with empty usage text, so they are excluded from `--help` output and generated reference docs. A preamble note was added to the input type documentation stating that UpperCamelCase type names are aliases — check the corresponding lowercase entry for full documentation. #### Related - open-component-model/ocm-project#962 - open-component-model/open-component-model#2057 - ocm-spec PR: open-component-model/ocm-spec#141 - Predecessor: #1881 --------- Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com> Co-authored-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
1 parent 618eb20 commit f5af619

19 files changed

Lines changed: 78 additions & 660 deletions

File tree

.github/config/wordlist.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
NeoNephos
12
accessmethod
23
accessmethoddescriptor
34
accessmethods
@@ -99,6 +100,7 @@ finalizer
99100
finalizers
100101
foldername
101102
forwardspec
103+
fulcio
102104
gapped
103105
gav
104106
getinexpensivecontentversionidentity
@@ -145,6 +147,7 @@ ioutils
145147
ipcei
146148
iterable
147149
json
150+
jsonNormalisation
148151
jsonschema
149152
keyless
150153
keypair
@@ -181,7 +184,6 @@ mvn
181184
mvnrepository
182185
namespace
183186
namespaces
184-
NeoNephos
185187
newcomponentaccess
186188
newcomponentversionaccess
187189
newrepository
@@ -201,6 +203,7 @@ ocm
201203
ocmbot
202204
ocmcli
203205
ocmconfig
206+
oidc
204207
oncefunc
205208
oo
206209
oras
@@ -229,6 +232,7 @@ pubsub
229232
readme
230233
readonly
231234
refcount
235+
rekor
232236
relativeocireference
233237
releasenotes
234238
releaser
@@ -268,13 +272,13 @@ struct
268272
subchart
269273
subcharts
270274
subst
275+
tcp
271276
tempfile
272277
templated
273278
templater
274279
templaters
275280
templating
276281
tgz
277-
tcp
278282
tls
279283
todo
280284
toi
@@ -291,6 +295,7 @@ uploader
291295
uploaderdescriptor
292296
uploaders
293297
uploadhandlers
298+
uppercamelcase
294299
url
295300
urls
296301
utf
@@ -307,7 +312,3 @@ yaml
307312
yitsushi
308313
yml
309314
yyyy
310-
jsonNormalisation
311-
rekor
312-
oidc
313-
fulcio

api/ocm/extensions/accessmethods/git/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ import (
2121
const (
2222
Type = "git"
2323
TypeV1Alpha1 = Type + runtime.VersionSeparator + "v1alpha1"
24+
25+
UpperType = "Git"
26+
UpperTypeV1Alpha1 = UpperType + runtime.VersionSeparator + "v1alpha1"
2427
)
2528

2629
func init() {
2730
// If we remove the default registration, also the docs are gone.
2831
// so we leave the default registration in.
2932
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
3033
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1Alpha1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
34+
35+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
36+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1Alpha1))
3137
}
3238

3339
// AccessSpec describes the access for a GitHub registry.

api/ocm/extensions/accessmethods/github/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import (
3030
const (
3131
Type = "gitHub"
3232
TypeV1 = Type + runtime.VersionSeparator + "v1"
33+
34+
UpperType = "GitHub"
35+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
3336
)
3437

3538
const (
@@ -44,6 +47,9 @@ func init() {
4447
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
4548
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](LegacyType))
4649
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](LegacyTypeV1))
50+
51+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
52+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
4753
}
4854

4955
func Is(spec accspeccpi.AccessSpec) bool {

api/ocm/extensions/accessmethods/maven/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ import (
1717
const (
1818
Type = "maven"
1919
TypeV1 = Type + runtime.VersionSeparator + "v1"
20+
21+
UpperType = "Maven"
22+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
2023
)
2124

2225
func init() {
2326
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
2427
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
28+
29+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
30+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
2531
}
2632

2733
// AccessSpec describes the access for a Maven artifact.

api/ocm/extensions/accessmethods/npm/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ import (
1414
const (
1515
Type = "npm"
1616
TypeV1 = Type + runtime.VersionSeparator + "v1"
17+
18+
UpperType = "NPM"
19+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
1720
)
1821

1922
func init() {
2023
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
2124
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
25+
26+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
27+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
2228
}
2329

2430
// AccessSpec describes the access for a NPM registry.

api/ocm/extensions/accessmethods/wget/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ import (
2020
const (
2121
Type = "wget"
2222
TypeV1 = Type + runtime.VersionSeparator + "v1"
23+
24+
UpperType = "Wget"
25+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
2326
)
2427

2528
func init() {
2629
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
2730
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
31+
32+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
33+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
2834
}
2935

3036
func Is(spec accspeccpi.AccessSpec) bool {

cmds/ocm/commands/ocmcmds/common/inputs/inputtype.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,16 @@ func newGenericInputSpec(data []byte, unmarshaler runtime.Unmarshaler) (*Generic
431431
func Usage(scheme InputTypeScheme) string {
432432
s := `
433433
The resource specification supports the following blob input types, specified
434-
with the field <code>type</code> in the <code>input</code> field:`
434+
with the field <code>type</code> in the <code>input</code> field:
435+
436+
UpperCamelCase type names (e.g. <code>Helm</code>) are aliases for the corresponding
437+
lowercase types (e.g. <code>helm</code>). See the lowercase entry for full documentation.`
435438
for _, t := range scheme.KnownTypeNames() {
436-
s = fmt.Sprintf("%s\n\n- Input type <code>%s</code>\n\n%s", s, t, utils.IndentLines(scheme.GetInputType(t).Usage(), " "))
439+
it := scheme.GetInputType(t)
440+
if dit, ok := it.(*DefaultInputType); ok && dit.usage == "" {
441+
continue
442+
}
443+
s = fmt.Sprintf("%s\n\n- Input type <code>%s</code>\n\n%s", s, t, utils.IndentLines(it.Usage(), " "))
437444
}
438445
return s + "\n"
439446
}

cmds/ocm/commands/ocmcmds/common/inputs/types/directory/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const (
1212

1313
func init() {
1414
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(TYPE, &Spec{}, usage, ConfigHandler()))
15-
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{}, usage, ConfigHandler()))
15+
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{}, "", ConfigHandler()))
1616
}
1717

1818
const usage = `

cmds/ocm/commands/ocmcmds/common/inputs/types/file/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ func init() {
1313
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(TYPE, &Spec{},
1414
Usage("The path must denote a file relative the resources file. "), ConfigHandler()))
1515
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{},
16-
Usage("The path must denote a file relative the resources file. "), ConfigHandler()))
16+
"", ConfigHandler()))
1717
}

cmds/ocm/commands/ocmcmds/common/inputs/types/git/type.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import (
55
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/common/inputs"
66
)
77

8-
const TYPE = "git"
8+
const (
9+
TYPE = "git"
10+
UPPER_TYPE = "Git"
11+
)
912

1013
func init() {
1114
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(TYPE, &Spec{}, usage, ConfigHandler()))
15+
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{}, "", ConfigHandler()))
1216
}
1317

1418
const usage = `

0 commit comments

Comments
 (0)