Skip to content

Commit 8c768ac

Browse files
ryanyuansean-
andauthored
Add missing acronyms (OS, ARN, VM ...) to cmd/osgen's initialism table (#1047)
* Add missing acronyms (OS, ARN, CFS, DN, IAM, IO, JDK, LLM, MAC, MHz, PID, RRF, SSO, VM, SES, SNS, SQS) to cmd/osgen's initialism table NodesInfoNode.Os renders as Os instead of OS because the acronym table cmd/osgen/naming.go derives Go field names from didn't list it, unlike the existing API/HTTP/JSON entries. Auditing every generated JSON tag segment for the same gap surfaced 14 more: ARN, CFS, DN, IAM, IO, JDK, LLM, MAC, MHz, PID, RRF, SSO, TTF, VM and SES, SNS, SQS. Add all 15 to the table and regenerate; the diff is confined to the fields that use these segments (e.g. VmName -> VMName, SsoLogoutURL -> SSOLogoutURL, RoleArn -> RoleARN). Signed-off-by: Ryan Yuan <ryan.yuan@crowdstrike.com> Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com> Co-authored-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent 62c2263 commit 8c768ac

19 files changed

Lines changed: 147 additions & 130 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
200200
- **BREAKING**: Partial-failure errors are now reported by default. `Config.Errors == nil` resolves to `errmask.Empty` (report every partial-failure category) instead of v4's `errmask.All` (mask everything). Set `Errors: errmask.New(errmask.All)` or `OPENSEARCH_GO_ERROR_MASK` to restore v4-style masking ([#816](https://github.com/opensearch-project/opensearch-go/issues/816))
201201
- **BREAKING**: `cmd/osgen` now treats the OpenSearch plugin acronyms `ISM`, `KNN`, `LTR`, `ML`, `PPL`, `SM`, `UBI`, and `WLM` as initialisms, so generated identifiers are all-uppercase per Go convention (matching the existing `API`, `HTTP`, `JSON`, etc. handling). Renames every affected `*_gen.go` type, path builder, and method, e.g. `IsmPolicy` -> `ISMPolicy`, `KnnStats` -> `KNNStats`, `SmPolicy` -> `SMPolicy`. Update any direct references to the renamed identifiers; the lowercase plugin package names (`ism`, `knn`, ...) are unchanged ([#863](https://github.com/opensearch-project/opensearch-go/issues/863))
202202
- `cmd/osgen` recognizes more acronyms as initialisms, extending the set from [#863](https://github.com/opensearch-project/opensearch-go/issues/863). Adds `BM25`, `CJK`, `CSV`, `DFI`, `DFR`, `FS`, `GC`, `HDR`, `HTML`, `IB`, `ICU`, `IDs`, `JVM`, `LMD`, `LMJ`, `MMap`, `NIO`, `PITs`, `SMTP`, `SNS`, `TFIDF`, `UAX`, `WKT`, and `XY` to the generator's acronym table, so generated identifiers use idiomatic Go capitalization (e.g. `IndicesIndexSettingsSimilarityBM25`, `CommonAnalysisCJKAnalyzer`, `CommonQueryDSLIDsQuery`, `GetAllPITsReq`, `NodesStatsLastGC`, `ClusterStatsClusterJVM`). Plural acronyms keep a lowercase `s` (`IDs`, `PITs`) per Go convention; the memory-map and NIO store types follow `MMap`/`NIO`. JSON wire tags are unchanged ([#961](https://github.com/opensearch-project/opensearch-go/issues/961))
203+
- **BREAKING**: `cmd/osgen` now treats `ARN`, `CFS`, `DN`, `IAM`, `IO`, `JDK`, `LLM`, `MAC`, `MHz`, `OS`, `PID`, `RRF`, `SES`, `SSO`, `TTF`, and `VM` as initialisms, extending the acronym table from [#961](https://github.com/opensearch-project/opensearch-go/issues/961) (matching the existing `API`/`HTTP`/`JSON` handling). Renames every affected `*_gen.go` field across `opensearchapi` and the plugin packages, e.g. `NodesInfoNode.Os` -> `OS`, `NodesStatsStats.IoStats` -> `IOStats`, `ClusterStatsClusterNodes.VmName` -> `VMName`, `NodesInfoNode.Pid` -> `PID`, `NodesInfoNode.MacAddress` -> `MACAddress`, `AuthinfoResp.SsoLogoutURL` -> `SSOLogoutURL`, `WhoAmIResp.Dn` -> `DN`, `MLRegisterAgentsBody.Llm` -> `LLM`, `IamRoleArn` -> `IAMRoleARN`, `TopicArn`/`CampaignArn` -> `TopicARN`/`CampaignARN`, `CombRrfExecutions`/`CombRrfProcessors` -> `CombRRFExecutions`/`CombRRFProcessors`, `SumTtf` -> `SumTTF`, `NotificationsSesAccount` -> `NotificationsSESAccount` (with the `GetConfigsParams.SesAccount*` query parameters following as `SESAccount*`), and `CfsPeriodMicros`/`CfsQuotaMicros`/`NoCfsRatio` -> `CFSPeriodMicros`/`CFSQuotaMicros`/`NoCFSRatio`. JSON wire tags are unchanged
203204
- `cmd/osgen` derives clearer names for `oneOf`/`anyOf` union branches. Aggregation-result branches that the spec titles with terse codes split into readable Go names (`Lterms` -> `LTerms`, `Tdigest` -> `TDigest`, and the full long/string/unsigned/unmapped/significant family), so the `As*`/`New*From*` methods on types like `SearchResultAggregationsValue` read as `AsLTerms`/`AsTDigestPercentiles`. Inline-object branches carry their spec `title` where one exists (a hyphenated title normalizes to PascalCase, `score-ranker-processor` -> `ScoreRankerProcessor`); untitled members are named from their content instead of their spec-array position, so a branch is named for its first required field or, when it declares none, for its property names (`IndicesOpenRespBodyObject0`/`Object1` -> `...Task`/`...Acknowledged`, `WLMQueryGroupRespResourceLimitsObject0`/`Object1` -> `...Memory`/`...CPU`, `SearchBodySourceObject1` -> `...ExcludesIncludes`). The name no longer shifts when the spec reorders a union's members. Two branches with identical fields that cannot be told apart keep a positional `ObjectN` name. Branch accessors and constructors no longer repeat the union prefix, so `NewInsightsSourceSourceFromInsightsSourceSourceObject1` becomes `NewInsightsSourceSourceFromExcludesIncludes` ([#961](https://github.com/opensearch-project/opensearch-go/issues/961))
204205
- **BREAKING**: `opensearchtransport.ConnectionObserver` interface gained an `OnAddressRewrite(AddressRewriteEvent)` method for the new address resolver feature (embedders of `BaseConnectionObserver` are unaffected) ([#822](https://github.com/opensearch-project/opensearch-go/pull/822))
205206
- **BREAKING**: Rename `opensearchtransport.Client` to `opensearchtransport.Transport` so the type name reflects its role (HTTP round-trip concerns: connection pool, retries, node selection, discovery) rather than colliding conceptually with `opensearch.Client` and `opensearchapi.Client`. The `Client` name is removed; update references to `Transport` ([#853](https://github.com/opensearch-project/opensearch-go/issues/853))

cmd/osgen/naming.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,53 +157,69 @@ func replaceAtPascalBoundary(s, old, next string, tailUpperOnly bool) string {
157157
//nolint:gochecknoglobals // const-ish read-only lookup table
158158
var acronyms = map[string]string{
159159
"api": "API",
160+
"arn": "ARN", // Amazon Resource Name
160161
"bm25": "BM25", // Best Matching 25 ranking function
162+
"cfs": "CFS", // Completely Fair Scheduler (cgroup)
161163
"cjk": "CJK", // Chinese, Japanese, Korean
162164
"cpu": "CPU",
163165
"csv": "CSV",
164166
"dfi": "DFI", // Divergence From Independence
165167
"dfr": "DFR", // Divergence From Randomness
166168
"dfs": "DFS", // Distributed Frequency Search
169+
"dn": "DN", // Distinguished Name (LDAP)
167170
"dsl": "DSL",
168171
"fs": "FS", // File System (store type)
169172
"gc": "GC", // Garbage Collection
170173
"hdr": "HDR", // High Dynamic Range (percentiles)
171174
"html": "HTML",
172175
"http": "HTTP",
173176
"https": "HTTPS",
177+
"iam": "IAM", // Identity and Access Management
174178
"ib": "IB", // Information-Based similarity
175179
"icu": "ICU", // International Components for Unicode
176180
"id": "ID",
177181
"ids": "IDs",
182+
"io": "IO", // Input/Output
178183
"ip": "IP",
179184
"ip2geo": "IP2Geo", // IP-to-geolocation datasource (geospatial plugin)
180185
"ism": "ISM", // Index State Management
186+
"jdk": "JDK", // Java Development Kit
181187
"json": "JSON",
182188
"jvm": "JVM",
183189
"knn": "KNN", // k-Nearest Neighbors
190+
"llm": "LLM", // Large Language Model
184191
"lmd": "LMD", // Language Model Dirichlet similarity
185192
"lmj": "LMJ", // Language Model Jelinek-Mercer similarity
186193
"ltr": "LTR", // Learning to Rank
194+
"mac": "MAC", // Media Access Control (address)
195+
"mhz": "MHz", // Megahertz
187196
"ml": "ML", // Machine Learning
188197
"mmap": "MMap", // memory-mapped store type
189198
"nio": "NIO", // New I/O (Java, store type)
199+
"os": "OS", // Operating System
200+
"pid": "PID", // Process ID
190201
"pit": "PIT", // Point In Time
191202
"pits": "PITs",
192203
"ppl": "PPL", // Piped Processing Language
204+
"rrf": "RRF", // Reciprocal Rank Fusion
205+
"ses": "SES", // Simple Email Service
193206
"sm": "SM", // Snapshot Management
194207
"smtp": "SMTP",
195208
"sns": "SNS", // Simple Notification Service
196209
"sql": "SQL",
197210
"ssl": "SSL",
211+
"sso": "SSO", // Single Sign-On
198212
"tcp": "TCP",
199213
"tfidf": "TFIDF", // Term Frequency-Inverse Document Frequency
200214
"tls": "TLS",
215+
"ttf": "TTF", // Total Term Frequency
201216
"ttl": "TTL",
202217
"uax": "UAX", // Unicode Annex (UAX #29 text segmentation)
203218
"ubi": "UBI", // User Behavior Insights
204219
"uri": "URI",
205220
"url": "URL",
206221
"uuid": "UUID",
222+
"vm": "VM", // Virtual Machine
207223
"wkt": "WKT", // Well-Known Text (geometry format)
208224
"wlm": "WLM", // Workload Management
209225
"xml": "XML",

opensearchapi/cat-nodeattrs_gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensearchapi/cat-nodes_gen.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensearchapi/cat-thread_pool_gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensearchapi/cluster-stats_gen.go

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensearchapi/enums_gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensearchapi/mtermvectors_gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensearchapi/nodes-info_gen.go

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)