Skip to content

pkg/openapi: restore v5.2.2 model type names as aliases - #34

Open
DzmitryHumianiuk wants to merge 1 commit into
masterfrom
fix/openapi-compat-v5-aliases
Open

DzmitryHumianiuk wants to merge 1 commit into
masterfrom
fix/openapi-compat-v5-aliases

Conversation

@DzmitryHumianiuk

Copy link
Copy Markdown
Member

Summary

Refs #32. This is the "stay on v5" option from the issue: it restores the short model type names that pkg/openapi exported at v5.2.2, wherever the new generated type is provably the same thing. It does not touch the module path, the tags or the README install line; those decisions stay with the maintainers.

After the OpenAPI regeneration, 137 of the 186 model type names of v5.2.2 no longer existed on master. This PR restores 116 of them as type aliases. 21 are not restored, and the reasons are listed below. With this branch, the Ginkgo agent from #15 (pkg/ginkgo, head 07ad5c4) builds against current goRP code without changes.

Changes

  • scripts/openapi-compat/compat.go.tmpl and its copy pkg/openapi/compat.go: a new block of 116 aliases between BEGIN v5.2.2 names and END v5.2.2 names, grouped by the Java package of the target type. The hand-written part of the file is unchanged. The two files are byte-identical, as the Taskfile's cp produces them.
  • scripts/openapi-compat/v5names.go (new, //go:build ignore): the tool that builds the mapping and writes the alias block, the test and a report. It reads the current tree without its own block, so a second run gives the same output.
  • pkg/gorp/openapi_compat_v5_test.go (new, generated): a compile-level check. For each of the 135 short names (116 restored and 19 that were already aliased) it references the name, pins the alias target, and checks every v5.2.2 field with its v5.2.2 Go type. It lives in pkg/gorp because task generate-openapi-client deletes and recreates pkg/openapi.
  • AGENTS.md: a short note on the block, the tool and the test.

Mapping rule

An alias Old = New is emitted only when all of these hold:

  1. Old is a v5.2.2 model type (not Nullable*, Api*Request or *APIService) that no longer resolves on master.
  2. Exactly one schema key in reportportal-api-docs.json has the class name Old after its Java package segments are stripped. Examples: com.epam.reportportal.base.reporting.Issue gives Issue; …model.BulkRQJava.lang.LongCom.epam.…launch.UpdateLaunchRQ gives BulkRQLongUpdateLaunchRQ; the nested class …reporting.Issue.ExternalSystemIssue gives ExternalSystemIssue. Two keys with the same class name would be "ambiguous" and get no alias. This did not occur.
  3. If no key matches (rule 2b in the script): every field that had type Old in an already mapped v5.2.2 struct now has one and the same type in the same position. This restores two names: ItemAttributeResource (11 fields, all now …ReportingAttributeResource, with the same key and value JSON fields) and PagedLogResourcePagesLocationInner (an inline schema of PagedLogResource).
  4. The JSON field names of the v5.2.2 struct are a subset of the JSON field names of the new struct.

No two short names point to the same long type (grep -E '^\t[A-Z][A-Za-z0-9]* += ' pkg/openapi/compat.go | awk '{print $3}' | sort | uniq -d prints nothing).

ItemAttributeResource is the one alias that does not come from a class name. Its JSON fields (key, value) are also present in ItemAttributesRQ (key, value, system), so the field check alone does not separate the two; the position of the type in 11 fields does. v5.2.2 had both names, and ItemAttributesRQ already maps to its own class, which leaves AttributeResource as the only counterpart. If maintainers prefer not to rely on this rule, delete rule 2b from the script and rerun it: both position-matched aliases and their test blocks disappear, and 10 structs (3 of them aliased before this PR) get an Attributes/From/To field that no longer compiles under the v5.2.2 type name.

The 30 model names that are still declared on master have all their v5.2.2 fields with unchanged Go types.

The rule was checked against the 19 aliases that compat.go already had for v5.2.2 names. It reproduces all 19 targets, including LaunchResource (the reporting model) versus LaunchViewModel.

Restored aliases (116)

114 are matched by schema key and 2 by position. 13 of the 116 still differ from v5.2.2 at the Go level, because a field type or a constructor signature changed upstream. Those are listed in the next section.

All 116 aliases
v5.2.2 name Type on master Notes
ActivityEventResource ComEpamReportportalBaseModelActivityEventResource fields: Details interface{} -> Details map[string]interface{}
ActivityResource ComEpamReportportalBaseInfrastructureModelActivityResource fields: Details interface{} -> Details map[string]interface{}
constructor: (int64, string, int64, time.Time, string, string, int64) (*ActivityResource) -> (int64, string, int64, int64, time.Time, string, string, int64) (*ComEpamReportportalBaseInfrastructureModelActivityResource)
AddProjectToGroupByIdRequest ComEpamReportportalApiModelAddProjectToGroupByIdRequest
AddWidgetRq ComEpamReportportalBaseModelDashboardAddWidgetRq
AnalyzeLaunchRQ ComEpamReportportalBaseModelLaunchAnalyzeLaunchRQ
ApiKeyRQ ComEpamReportportalBaseModelApiKeyRQ
ApiKeyRS ComEpamReportportalBaseModelApiKeyRS
ApiKeysRS ComEpamReportportalBaseModelApiKeysRS
AssignUsersRQ ComEpamReportportalBaseModelProjectAssignUsersRQ
BatchElementCreatedRS ComEpamReportportalBaseReportingBatchElementCreatedRS
BatchSaveOperatingRS ComEpamReportportalBaseReportingBatchSaveOperatingRS
BinaryContent ComEpamReportportalBaseModelLogLogResourceBinaryContent
BulkInfoUpdateRQ ComEpamReportportalBaseReportingBulkInfoUpdateRQ
BulkItemsRQ ComEpamReportportalBaseModelBulkItemsRQ
BulkRQLongFinishExecutionRQ ComEpamReportportalBaseModelBulkRQJavaLangLongComEpamReportportalBaseReportingFinishExecutionRQ
BulkRQLongUpdateLaunchRQ ComEpamReportportalBaseModelBulkRQJavaLangLongComEpamReportportalBaseModelLaunchUpdateLaunchRQ
BulkUpdateFilterRQ ComEpamReportportalBaseModelFilterBulkUpdateFilterRQ
ChangePasswordRQ ComEpamReportportalBaseModelUserChangePasswordRQ
ChartStatisticsContent ComEpamReportportalBaseInfrastructurePersistenceEntityWidgetContentChartStatisticsContent fields: Values map[string]string -> Values *map[string]string
ClusterInfoResource ComEpamReportportalBaseInfrastructureModelLaunchClusterClusterInfoResource
CollectionsRQBulkUpdateFilterRQ ComEpamReportportalBaseModelCollectionsRQComEpamReportportalBaseModelFilterBulkUpdateFilterRQ
ContentParameters ComEpamReportportalBaseModelWidgetContentParameters
CreateClustersRQ ComEpamReportportalBaseModelLaunchClusterCreateClustersRQ
CreateDashboardRQ ComEpamReportportalBaseModelDashboardCreateDashboardRQ
CreateIssueSubTypeRQ ComEpamReportportalBaseModelProjectConfigCreateIssueSubTypeRQ
CreatePatternTemplateRQ ComEpamReportportalBaseModelProjectConfigPatternCreatePatternTemplateRQ
DashboardConfigResource ComEpamReportportalBaseModelDashboardDashboardConfigResource
DashboardPreconfiguredRq ComEpamReportportalBaseModelDashboardDashboardPreconfiguredRq
DashboardResource ComEpamReportportalBaseModelDashboardDashboardResource
DefineIssueRQ ComEpamReportportalBaseModelIssueDefineIssueRQ
DeleteBulkRS ComEpamReportportalBaseModelDeleteBulkRS
DemoDataRq ComEpamReportportalBaseDemodataModelDemoDataRq
DemoDataRs ComEpamReportportalBaseDemodataModelDemoDataRs
Description ComEpamReportportalBaseReportingBulkInfoUpdateRQDescription
EditUserRQ ComEpamReportportalBaseModelUserEditUserRQ
EntryCreatedRS ComEpamReportportalBaseModelEntryCreatedRS
ErrorRS ComEpamReportportalBaseInfrastructureRulesExceptionErrorRS
ExternalSystemIssue ComEpamReportportalBaseReportingIssueExternalSystemIssue
GetLogTypes200Response ComEpamReportportalApiModelGetLogTypes200Response
GetLogsUnderRq ComEpamReportportalBaseModelLogGetLogsUnderRq
IntegrationRQ ComEpamReportportalBaseModelIntegrationIntegrationRQ
IntegrationResource ComEpamReportportalBaseModelIntegrationIntegrationResource
IntegrationTypeResource ComEpamReportportalBaseModelIntegrationIntegrationTypeResource
Issue ComEpamReportportalBaseReportingIssue
IssueDefinition ComEpamReportportalBaseModelIssueIssueDefinition
IssueSubTypeCreatedRS ComEpamReportportalBaseModelProjectConfigIssueSubTypeCreatedRS
IssueSubTypeResource ComEpamReportportalBaseModelProjectConfigIssueSubTypeResource
ItemAttributeResource ComEpamReportportalBaseReportingAttributeResource matched by position: LaunchResource.Attributes, LaunchResourceOld.Attributes, LaunchViewModel.Attributes, MergeLaunchesRQ.Attributes, SenderCaseDTO.Attributes, TestItemResource.Attributes, TestItemResourceOld.Attributes, UpdateItemAttributeRQ.From, UpdateItemAttributeRQ.To, UpdateLaunchRQ.Attributes, UpdateTestItemRQ.Attributes
ItemPathName ComEpamReportportalBaseReportingItemPathName
LaunchImportRQ ComEpamReportportalBaseModelLaunchLaunchImportRQ
LaunchPathName ComEpamReportportalBaseReportingLaunchPathName
LaunchResourceOld ComEpamReportportalBaseReportingLaunchResourceOld fields: Status string -> Status *string
constructor: (int64, string, string, int64, time.Time, string) (*LaunchResourceOld) -> (int64, string, string, int64, time.Time) (*ComEpamReportportalBaseReportingLaunchResourceOld)
LaunchesPerUser ComEpamReportportalBaseModelProjectLaunchesPerUser
LinkExternalIssueRQ ComEpamReportportalBaseModelItemLinkExternalIssueRQ fields: Issues ExternalSystemIssue -> Issues []ComEpamReportportalBaseReportingIssueExternalSystemIssue
constructor: ([]int64, ExternalSystemIssue) (*LinkExternalIssueRQ) -> ([]int64, []ComEpamReportportalBaseReportingIssueExternalSystemIssue) (*ComEpamReportportalBaseModelItemLinkExternalIssueRQ)
LogEntry ComEpamReportportalBaseModelLogSearchLogRsLogEntry
LogResource ComEpamReportportalBaseModelLogLogResource
MultiValueMapStringString OrgSpringframeworkUtilMultiValueMapJavaLangStringJavaLangString fields: All map[string]string -> All *map[string]string
OwnedEntityResource ComEpamReportportalBaseModelOwnedEntityResource
Page ComEpamReportportalBaseModelPage fields: Content []interface{} -> Content []map[string]interface{}
PageClusterInfoResource ComEpamReportportalBaseModelPageComEpamReportportalBaseInfrastructureModelLaunchClusterClusterInfoResource
PageDashboardResource ComEpamReportportalBaseModelPageComEpamReportportalBaseModelDashboardDashboardResource
PageLogResource ComEpamReportportalBaseModelPageComEpamReportportalBaseModelLogLogResource
PageObject ComEpamReportportalBaseModelPageJavaLangObject fields: Content []interface{} -> Content []map[string]interface{}
PageOwnedEntityResource ComEpamReportportalBaseModelPageComEpamReportportalBaseModelOwnedEntityResource
PagePagedLogResource ComEpamReportportalBaseModelPageComEpamReportportalBaseCoreLogImplPagedLogResource
PageProjectInfoResource ComEpamReportportalBaseModelPageComEpamReportportalBaseModelProjectProjectInfoResource
PageTestItemHistoryElement ComEpamReportportalBaseModelPageComEpamReportportalBaseModelTestItemHistoryElement
PageTestItemResource ComEpamReportportalBaseModelPageComEpamReportportalBaseReportingTestItemResource
PageUserResource ComEpamReportportalBaseModelPageComEpamReportportalBaseModelUserUserResource
PagedLogResource ComEpamReportportalBaseCoreLogImplPagedLogResource
PagedLogResourcePagesLocationInner ComEpamReportportalBaseCoreLogImplPagedLogResourcePagesLocationInner matched by position: PagedLogResource.PagesLocation
ParameterResource ComEpamReportportalBaseReportingParameterResource
PatchDashboardRQ ComEpamReportportalBaseModelDashboardPatchDashboardRQ
PathNameResource ComEpamReportportalBaseReportingPathNameResource
PatternTemplateResource ComEpamReportportalBaseModelProjectConfigPatternPatternTemplateResource
Position ComEpamReportportalBaseModelPosition
PreferenceResource ComEpamReportportalBaseModelPreferencePreferenceResource
ProjectConfiguration ComEpamReportportalBaseModelProjectProjectConfiguration fields: SubTypes map[string][]IssueSubTypeResource -> SubTypes *map[string][]ComEpamReportportalBaseModelProjectConfigIssueSubTypeResource
ProjectConfigurationUpdate ComEpamReportportalBaseModelProjectConfigProjectConfigurationUpdate
ProjectGroupsPage ComEpamReportportalApiModelProjectGroupsPage
ProjectInfoResource ComEpamReportportalBaseModelProjectProjectInfoResource constructor: (int64, string, int32, int32, time.Time, time.Time) (*ProjectInfoResource) -> (int64, string, int32, int32, time.Time, time.Time, string, string) (*ComEpamReportportalBaseModelProjectProjectInfoResource)
ProjectNotificationConfigDTO ComEpamReportportalBaseModelProjectEmailProjectNotificationConfigDTO
ProjectSettingsResource ComEpamReportportalBaseModelProjectConfigProjectSettingsResource
ProjectUser ComEpamReportportalBaseModelProjectProjectResourceProjectUser
ResetPasswordRQ ComEpamReportportalBaseModelUserResetPasswordRQ
RestorePasswordRQ ComEpamReportportalBaseModelUserRestorePasswordRQ
SearchLogRq ComEpamReportportalBaseModelLogSearchLogRq
SearchLogRs ComEpamReportportalBaseModelLogSearchLogRs
SenderCaseDTO ComEpamReportportalBaseModelProjectEmailSenderCaseDTO
Size ComEpamReportportalBaseModelSize
StartLaunchRS ComEpamReportportalBaseReportingStartLaunchRS
StatisticsResource ComEpamReportportalBaseReportingStatisticsResource fields: Executions map[string]int32 -> Executions *map[string]int32; Defects map[string]map[string]int32 -> Defects *map[string]map[string]int32
SuggestInfo ComEpamReportportalBaseCoreAnalyzerAutoClientModelSuggestInfo
SuggestedItem ComEpamReportportalBaseCoreAnalyzerAutoImplSuggestedItem
TestItemHistoryElement ComEpamReportportalBaseModelTestItemHistoryElement
TestItemResource ComEpamReportportalBaseReportingTestItemResource
TestItemResourceOld ComEpamReportportalBaseReportingTestItemResourceOld
UnassignUsersRQ ComEpamReportportalBaseModelProjectUnassignUsersRQ
UnlinkExternalIssueRQ ComEpamReportportalBaseModelItemUnlinkExternalIssueRQ
UpdateDashboardRQ ComEpamReportportalBaseModelDashboardUpdateDashboardRQ
UpdateIssueSubTypeRQ ComEpamReportportalBaseModelProjectConfigUpdateIssueSubTypeRQ
UpdateItemAttributeRQ ComEpamReportportalBaseReportingUpdateItemAttributeRQ
UpdateLaunchRQ ComEpamReportportalBaseModelLaunchUpdateLaunchRQ
UpdateOneIssueSubTypeRQ ComEpamReportportalBaseModelProjectConfigUpdateOneIssueSubTypeRQ
UpdatePatternTemplateRQ ComEpamReportportalBaseModelProjectConfigPatternUpdatePatternTemplateRQ
UpdatePluginStateRQ ComEpamReportportalBaseModelIntegrationUpdatePluginStateRQ
UpdateProjectRQ ComEpamReportportalBaseModelProjectUpdateProjectRQ fields: Users map[string]string -> Users *map[string]string
UpdateTestItemRQ ComEpamReportportalBaseModelItemUpdateTestItemRQ
UpdateUserFilterRQ ComEpamReportportalBaseModelFilterUpdateUserFilterRQ
UserResource ComEpamReportportalBaseModelUserUserResource fields: Metadata interface{} -> Metadata map[string]interface{}; AssignedProjects map[string]AssignedProject -> AssignedProjects *map[string]ComEpamReportportalBaseModelUserUserResourceAssignedProject
WidgetConfigResource ComEpamReportportalBaseModelWidgetWidgetConfigResource
WidgetObjectModel ComEpamReportportalBaseModelDashboardDashboardResourceWidgetObjectModel
WidgetPreviewRQ ComEpamReportportalBaseModelWidgetWidgetPreviewRQ
WidgetRQ ComEpamReportportalBaseModelWidgetWidgetRQ
WidgetResource ComEpamReportportalBaseModelWidgetWidgetResource
YesNoRS ComEpamReportportalBaseModelYesNoRS

Restored names that are not fully source-compatible

The name and the JSON shape are back, but v5.2.2 code that touches these fields or constructors still needs a change. In the "fields" and "constructor" entries, the left side of -> is v5.2.2 and the right side is master.

v5.2.2 name Type on master Go-level differences
ActivityEventResource ComEpamReportportalBaseModelActivityEventResource fields: Details interface{} -> Details map[string]interface{}
ActivityResource ComEpamReportportalBaseInfrastructureModelActivityResource fields: Details interface{} -> Details map[string]interface{}
constructor: (int64, string, int64, time.Time, string, string, int64) (*ActivityResource) -> (int64, string, int64, int64, time.Time, string, string, int64) (*ComEpamReportportalBaseInfrastructureModelActivityResource)
ChartStatisticsContent ComEpamReportportalBaseInfrastructurePersistenceEntityWidgetContentChartStatisticsContent fields: Values map[string]string -> Values *map[string]string
LaunchResourceOld ComEpamReportportalBaseReportingLaunchResourceOld fields: Status string -> Status *string
constructor: (int64, string, string, int64, time.Time, string) (*LaunchResourceOld) -> (int64, string, string, int64, time.Time) (*ComEpamReportportalBaseReportingLaunchResourceOld)
LinkExternalIssueRQ ComEpamReportportalBaseModelItemLinkExternalIssueRQ fields: Issues ExternalSystemIssue -> Issues []ComEpamReportportalBaseReportingIssueExternalSystemIssue
constructor: ([]int64, ExternalSystemIssue) (*LinkExternalIssueRQ) -> ([]int64, []ComEpamReportportalBaseReportingIssueExternalSystemIssue) (*ComEpamReportportalBaseModelItemLinkExternalIssueRQ)
MultiValueMapStringString OrgSpringframeworkUtilMultiValueMapJavaLangStringJavaLangString fields: All map[string]string -> All *map[string]string
Page ComEpamReportportalBaseModelPage fields: Content []interface{} -> Content []map[string]interface{}
PageObject ComEpamReportportalBaseModelPageJavaLangObject fields: Content []interface{} -> Content []map[string]interface{}
ProjectConfiguration ComEpamReportportalBaseModelProjectProjectConfiguration fields: SubTypes map[string][]IssueSubTypeResource -> SubTypes *map[string][]ComEpamReportportalBaseModelProjectConfigIssueSubTypeResource
ProjectInfoResource ComEpamReportportalBaseModelProjectProjectInfoResource constructor: (int64, string, int32, int32, time.Time, time.Time) (*ProjectInfoResource) -> (int64, string, int32, int32, time.Time, time.Time, string, string) (*ComEpamReportportalBaseModelProjectProjectInfoResource)
StatisticsResource ComEpamReportportalBaseReportingStatisticsResource fields: Executions map[string]int32 -> Executions *map[string]int32; Defects map[string]map[string]int32 -> Defects *map[string]map[string]int32
UpdateProjectRQ ComEpamReportportalBaseModelProjectUpdateProjectRQ fields: Users map[string]string -> Users *map[string]string
UserResource ComEpamReportportalBaseModelUserUserResource fields: Metadata interface{} -> Metadata map[string]interface{}; AssignedProjects map[string]AssignedProject -> AssignedProjects *map[string]ComEpamReportportalBaseModelUserUserResourceAssignedProject

Among the 19 names that were aliased before this PR, the same kind of difference remains here:

  • LaunchResource = ComEpamReportportalBaseReportingLaunchResource — rule agrees; Go field differences: Status string -> Status *string
  • LaunchViewModel = ComEpamReportportalBaseModelLaunchLaunchViewModel — rule agrees; Go field differences: Status string -> Status *string

Not restored (21)

No counterpart (18). No schema key in the current spec has this class name, and rule 2b finds no single type that replaced it:

  • AllowedValue
  • AnalyticsResource
  • CreateProjectRQ
  • CreateUserBidRS
  • CreateUserRQ
  • CreateUserRQConfirm
  • CreateUserRQFull
  • CreateUserRS
  • NamedValue
  • PageSearchUserResource
  • PagedResponseActivityEventResource
  • PostFormField
  • PostTicketRQ
  • SearchCriteria
  • SearchUserResource
  • Ticket
  • UpdateSettingsRq
  • UserBidRS

Most of these names appear to belong to API areas whose request and service types are also gone (see the lists below: bug tracking tickets, user creation and bids, user search, project creation, onboarding). I did not trace the reason for each of the 18 names one by one.

JSON fields differ (3). Exactly one candidate exists, but a v5.2.2 JSON field is gone. An alias would compile for some code and fail for code that uses the missing field, so none is added:

  • AssignedProject — JSON fields gone: projectId (candidate ComEpamReportportalBaseModelUserUserResourceAssignedProject)
  • ProjectResource — JSON fields gone: entryType (candidate ComEpamReportportalBaseModelProjectProjectResource)
  • SearchCriteriaRQ — JSON fields gone: search_criterias (candidate ComEpamReportportalApiModelSearchCriteriaRQ)

Ambiguous: 0. Different kind of type: 0.

Still broken and not addressed here

These are counted by the same tool and not fixed in this PR:

  • Constructors. NewX and NewXWithDefaults exist only under the long names. For the 116 restored names, the NewX signature is unchanged for 112 and changed for 4. Wrappers for the 112 could be generated the same way if maintainers want them. pkg/ginkgo uses none.
  • Nullable* wrappers. 156 of 181 names are gone.
  • Request builders. 19 of 230 Api*Request types are gone. 74 of the surviving ones lost 90 methods. Most are body setters named after the model: for example ApiCreateApiKeyRequest.ApiKeyRQ(...) is now .ComEpamReportportalBaseModelApiKeyRQ(...). compat.go already wraps two of these for MergeLaunchesRQ.
  • API services. 3 of 24 *APIService types are gone, and 4 surviving ones lost 16 methods.
Methods gone from surviving request types (90)

ApiAddGroupToProjectByIdRequest.AddProjectToGroupByIdRequest, ApiAddProjectToGroupByIdRequest.AddProjectToGroupByIdRequest, ApiAddWidgetRequest.AddWidgetRq, ApiAssignProjectUsersRequest.AssignUsersRQ, ApiBulkForceFinishRequest.BulkRQLongFinishExecutionRQ, ApiBulkUpdate1Request.BulkInfoUpdateRQ, ApiBulkUpdateRequest.BulkInfoUpdateRQ, ApiChangePasswordRequest.ChangePasswordRQ, ApiCreateApiKeyRequest.ApiKeyRQ, ApiCreateClustersRequest.CreateClustersRQ, ApiCreateDashboardRequest.CreateDashboardRQ, ApiCreateFilterRequest.UpdateUserFilterRQ, ApiCreateGlobalIntegrationRequest.IntegrationRQ, ApiCreateLogEntry1Request.SaveLogRQ, ApiCreateLogEntryRequest.SaveLogRQ, ApiCreateNotificationRequest.SenderCaseDTO, ApiCreatePatternTemplateRequest.CreatePatternTemplateRQ, ApiCreatePreconfiguredRequest.DashboardPreconfiguredRq, ApiCreateProjectIntegrationRequest.IntegrationRQ, ApiCreateProjectIssueSubTypeRequest.CreateIssueSubTypeRQ, ApiCreateWidgetRequest.WidgetRQ, ApiDefineTestItemIssueTypeRequest.DefineIssueRQ, ApiEditUserRequest.EditUserRQ, ApiExportProjectsRequest.FilterEqType, ApiFinishLaunch1Request.FinishExecutionRQ, ApiFinishLaunchRequest.FinishExecutionRQ, ApiFinishTestItem1Request.FinishTestItemRQ, ApiFinishTestItem2Request.FinishTestItemRQ, ApiFinishTestItem3Request.FinishTestItemRQ, ApiFinishTestItemRequest.FinishTestItemRQ, ApiForceFinishLaunchRequest.FinishExecutionRQ, ApiGenerateRequest.DemoDataRq, ApiGetAllProjectsInfoRequest.FilterEqType, ApiGetLogsUnderRequest.GetLogsUnderRq, ApiGetTestItemsByIdsRequest.BulkItemsRQ, ApiGetUsersRequest.FilterEqActive, ApiGetUsersRequest.FilterEqEmail, ApiGetUsersRequest.FilterEqExpired, ApiGetUsersRequest.FilterEqExternalId, ApiGetUsersRequest.FilterEqFullName, ApiGetUsersRequest.FilterEqId, ApiGetUsersRequest.FilterEqLastLogin, ApiGetUsersRequest.FilterEqProject, ApiGetUsersRequest.FilterEqProjectId, ApiGetUsersRequest.FilterEqRole, ApiGetUsersRequest.FilterEqSynchronizationDate, ApiGetUsersRequest.FilterEqType, ApiGetUsersRequest.FilterEqUser, ApiGetUsersRequest.FilterEqUuid, ApiGetUsersRequest.PagePage, ApiGetUsersRequest.PageSize, ApiGetUsersRequest.PageSort, ApiGetWidgetPreviewRequest.WidgetPreviewRQ, ApiHandleSuggestChooseRequest.SuggestInfo, ApiLinkExternalIssuesRequest.LinkExternalIssueRQ, ApiPatchDashboardRequest.PatchDashboardRQ, ApiResetPasswordRequest.ResetPasswordRQ, ApiRestorePasswordRequest.RestorePasswordRQ, ApiSaveAnalyticsSettings1Request.AnalyticsResource, ApiSaveAnalyticsSettingsRequest.AnalyticsResource, ApiSearchLogsRequest.SearchLogRq, ApiStartChildItem1Request.StartTestItemRQ, ApiStartChildItem2Request.StartTestItemRQ, ApiStartChildItem3Request.StartTestItemRQ, ApiStartChildItemRequest.StartTestItemRQ, ApiStartLaunch1Request.StartLaunchRQ, ApiStartLaunchAnalyzerRequest.AnalyzeLaunchRQ, ApiStartLaunchRequest.StartLaunchRQ, ApiStartRootItem1Request.StartTestItemRQ, ApiStartRootItem2Request.StartTestItemRQ, ApiStartRootItem3Request.StartTestItemRQ, ApiStartRootItemRequest.StartTestItemRQ, ApiUnassignProjectUsersRequest.UnassignUsersRQ, ApiUnlinkExternalIssuesRequest.UnlinkExternalIssueRQ, ApiUpdateDashboardRequest.UpdateDashboardRQ, ApiUpdateGlobalIntegrationRequest.IntegrationRQ, ApiUpdateLaunchRequest.UpdateLaunchRQ, ApiUpdateLaunchesRequest.BulkRQLongUpdateLaunchRQ, ApiUpdateNotificationRequest.SenderCaseDTO, ApiUpdatePatternTemplateRequest.UpdatePatternTemplateRQ, ApiUpdatePluginStateRequest.UpdatePluginStateRQ, ApiUpdateProjectIntegrationRequest.IntegrationRQ, ApiUpdateProjectIssueSubTypeRequest.UpdateIssueSubTypeRQ, ApiUpdateProjectNotificationConfigRequest.ProjectNotificationConfigDTO, ApiUpdateProjectRequest.UpdateProjectRQ, ApiUpdateServerSettingsRequest.UpdateSettingsRq, ApiUpdateTestItemRequest.UpdateTestItemRQ, ApiUpdateUserFilterRequest.UpdateUserFilterRQ, ApiUpdateUserFiltersRequest.CollectionsRQBulkUpdateFilterRQ, ApiUpdateWidgetRequest.WidgetRQ

Methods gone from surviving service types (16)

ActivityEventAPIService.GetActivities, ActivityEventAPIService.GetActivitiesExecute, FileStorageAPIService.DeletePhoto, FileStorageAPIService.DeletePhotoExecute, FileStorageAPIService.GetMyPhoto, FileStorageAPIService.GetMyPhotoExecute, FileStorageAPIService.GetUserPhoto, FileStorageAPIService.GetUserPhotoExecute, FileStorageAPIService.UploadPhoto, FileStorageAPIService.UploadPhotoExecute, ProjectAPIService.CreateProject, ProjectAPIService.CreateProjectExecute, ProjectAPIService.SearchForUser, ProjectAPIService.SearchForUserExecute, WidgetAPIService.GetWidgetNames, WidgetAPIService.GetWidgetNamesExecute

Gone service names (3)

BugTrackingSystemAPIService, OnboardingAPIService, UserAPIService

Gone request names (19)

ApiCreateIssueRequest, ApiCreateProjectRequest, ApiCreateUserBidRequest, ApiCreateUserByAdminRequest, ApiCreateUserRequest, ApiDeletePhotoRequest, ApiGetActivitiesRequest, ApiGetAllowableIssueTypes1Request, ApiGetAllowableIssueTypesRequest, ApiGetMyPhotoRequest, ApiGetSetOfIntegrationSystemFields1Request, ApiGetSetOfIntegrationSystemFieldsRequest, ApiGetTicketRequest, ApiGetUserBidInfoRequest, ApiGetUserPhotoRequest, ApiGetWidgetNamesRequest, ApiOnBoardingRequest, ApiSearchForUserRequest, ApiUploadPhotoRequest

Gone nullable names (156)

NullableActivityEventResource, NullableActivityResource, NullableAddProjectToGroupByIdRequest, NullableAddWidgetRq, NullableAllowedValue, NullableAnalyticsResource, NullableAnalyzeLaunchRQ, NullableApiKeyRQ, NullableApiKeyRS, NullableApiKeysRS, NullableAssignUsersRQ, NullableAssignedProject, NullableBatchElementCreatedRS, NullableBatchSaveOperatingRS, NullableBinaryContent, NullableBulkInfoUpdateRQ, NullableBulkItemsRQ, NullableBulkRQLongFinishExecutionRQ, NullableBulkRQLongUpdateLaunchRQ, NullableBulkUpdateFilterRQ, NullableChangePasswordRQ, NullableChartStatisticsContent, NullableClusterInfoResource, NullableCollectionsRQBulkUpdateFilterRQ, NullableContentParameters, NullableCreateClustersRQ, NullableCreateDashboardRQ, NullableCreateIssueSubTypeRQ, NullableCreatePatternTemplateRQ, NullableCreateProjectRQ, NullableCreateUserBidRS, NullableCreateUserRQ, NullableCreateUserRQConfirm, NullableCreateUserRQFull, NullableCreateUserRS, NullableDashboardConfigResource, NullableDashboardPreconfiguredRq, NullableDashboardResource, NullableDefineIssueRQ, NullableDeleteBulkRS, NullableDemoDataRq, NullableDemoDataRs, NullableDescription, NullableEditUserRQ, NullableEntryCreatedAsyncRS, NullableEntryCreatedRS, NullableErrorRS, NullableExternalSystemIssue, NullableFile, NullableFinishExecutionRQ, NullableFinishLaunchRS, NullableFinishTestItemRQ, NullableGetLogTypes200Response, NullableGetLogsUnderRq, NullableIntegrationRQ, NullableIntegrationResource, NullableIntegrationTypeResource, NullableIssue, NullableIssueDefinition, NullableIssueSubTypeCreatedRS, NullableIssueSubTypeResource, NullableItemAttributeResource, NullableItemAttributesRQ, NullableItemPathName, NullableLaunchImportRQ, NullableLaunchPathName, NullableLaunchResource, NullableLaunchResourceOld, NullableLaunchViewModel, NullableLaunchesPerUser, NullableLinkExternalIssueRQ, NullableLogEntry, NullableLogResource, NullableMergeLaunchesRQ, NullableMultiValueMapStringString, NullableNamedValue, NullableOperationCompletionRS, NullableOrder, NullableOwnedEntityResource, NullablePage, NullablePageClusterInfoResource, NullablePageDashboardResource, NullablePageLaunchViewModel, NullablePageLogResource, NullablePageMetadata, NullablePageObject, NullablePageOwnedEntityResource, NullablePagePagedLogResource, NullablePageProjectInfoResource, NullablePageSearchUserResource, NullablePageTestItemHistoryElement, NullablePageTestItemResource, NullablePageUserFilterResource, NullablePageUserResource, NullablePagedLogResource, NullablePagedLogResourcePagesLocationInner, NullablePagedResponseActivityEventResource, NullableParameterResource, NullablePatchDashboardRQ, NullablePathNameResource, NullablePatternTemplateResource, NullablePosition, NullablePostFormField, NullablePostTicketRQ, NullablePreferenceResource, NullableProjectConfiguration, NullableProjectConfigurationUpdate, NullableProjectGroupsPage, NullableProjectInfoResource, NullableProjectNotificationConfigDTO, NullableProjectResource, NullableProjectSettingsResource, NullableProjectUser, NullableResetPasswordRQ, NullableRestorePasswordRQ, NullableSaveLogRQ, NullableSearchCriteria, NullableSearchCriteriaRQ, NullableSearchLogRq, NullableSearchLogRs, NullableSearchUserResource, NullableSenderCaseDTO, NullableSize, NullableStartLaunchRQ, NullableStartLaunchRS, NullableStartTestItemRQ, NullableStatisticsResource, NullableSuggestInfo, NullableSuggestedItem, NullableTestItemHistoryElement, NullableTestItemResource, NullableTestItemResourceOld, NullableTicket, NullableUnassignUsersRQ, NullableUnlinkExternalIssueRQ, NullableUpdateDashboardRQ, NullableUpdateIssueSubTypeRQ, NullableUpdateItemAttributeRQ, NullableUpdateLaunchRQ, NullableUpdateOneIssueSubTypeRQ, NullableUpdatePatternTemplateRQ, NullableUpdatePluginStateRQ, NullableUpdateProjectRQ, NullableUpdateSettingsRq, NullableUpdateTestItemRQ, NullableUpdateUserFilterRQ, NullableUserBidRS, NullableUserFilterCondition, NullableUserFilterResource, NullableUserResource, NullableWidgetConfigResource, NullableWidgetObjectModel, NullableWidgetPreviewRQ, NullableWidgetRQ, NullableWidgetResource, NullableYesNoRS

Verification

  • go build ./... and go vet ./... pass.
  • go test ./... passes (internal/commands, pkg/gorp).
  • task lint (golangci-lint v2.15.0 in Docker) reports 0 issues. task fmt leaves the tree unchanged.
  • task e2e was not run. The change adds type aliases only and does not alter what is sent to ReportPortal.
  • Removing the Issue alias makes go vet ./pkg/gorp/ fail with undefined: openapi.Issue in the new test.
  • Consumer check with a go.work that uses pkg/ginkgo from Add Ginkgo v2 agent and ginkgo-rp wrapper (pkg/ginkgo) #15 (07ad5c4) and goRP from a local directory:
    • goRP from origin/master (517efe6): go build ./... fails with undefined: openapi.ParameterResource (3 places) and undefined: openapi.Issue.
    • goRP from this branch: go build ./... and go vet ./... pass, with no edits to pkg/ginkgo.

Investigation log

Every step can be repeated from the repository root. $S is any empty scratch directory.

  1. Size of the break. Extract the old package and run the tool in report-only mode:
    mkdir -p $S/v522 && git archive v5.2.2 pkg/openapi | tar -x -C $S/v522
    go run scripts/openapi-compat/v5names.go -old $S/v522/pkg/openapi -report $S/report.md
    head -7 $S/report.md
    The tool parses both trees with go/parser. It counts 621 exported types at v5.2.2: 186 model, 181 Nullable*, 230 Api*Request, 24 *APIService. Of the 186 model names, 30 are still declared, 19 were aliased in compat.go, and 137 are gone. This matches pkg/openapi: v5.2.2 type names removed on master while module path stays /v5; v6.0.0 tag unusable for Go modules #32. (On this branch the tool ignores its own block, so it reports the same numbers before and after the change.)
  2. Why not a plain name-suffix match. Generated names are the Java class path in camel case. Issue is a suffix of both …ReportingIssue and …ReportingIssueExternalSystemIssue, and a camel-case suffix has no package boundary. The schema keys in reportportal-api-docs.json keep the dots, so the tool derives the class name from the key (simpleNames in the script) and derives the Go type name from the same key. A name-suffix hit is printed only as a hint for names with no key candidate. None of the 18 unmapped names has one.
  3. Generic and nested classes. Keys such as …model.PageCom.epam.….log.LogResource glue a generic type to the package of its argument. The tool strips the Com/Java/Org joint and concatenates the class parts (PageLogResource, BulkRQLongUpdateLaunchRQ, MultiValueMapStringString). For a non-generic key with two class parts (Issue.ExternalSystemIssue, LogResource.BinaryContent, SaveLogRQ.File) the inner name alone is also accepted, because that is how v5.2.2 named them. The inner-name form is not applied to generic keys, otherwise Page<LogResource> would compete with LogResource.
  4. Check on known answers. The 19 hand-written aliases for v5.2.2 names go through the same rule. The report section "Existing aliases checked against the rule" says "rule agrees" for all 19.
  5. Field gate. Fields are compared on the generated Go structs of both trees (JSON name from the struct tag), not on the spec, because scripts/openapi-preprocess.jq flattens allOf before generation. A candidate is rejected when a v5.2.2 JSON field is missing. This rejected AssignedProject, ProjectResource and SearchCriteriaRQ.
  6. Rule 2b, same position. After step 5, ItemAttributeResource had no key, yet 11 fields of mapped structs still referred to it. The spec now calls that class com.epam.reportportal.base.reporting.AttributeResource. The tool walks the old and the new field type in parallel. It accepts the new name only if all uses agree on one type and the shapes match ([]X to []Y, *X to *Y). The evidence is in the "matched by position" notes of the table. The same rule maps PagedLogResourcePagesLocationInner.
  7. Go-level differences. With the alias set final, each v5.2.2 field type and NewX signature is compared with the new one, after resolving names through the aliases. A difference does not block an alias, because the type is still the same class, but it is reported. The generated test checks such a field with is[any] and a comment instead of its old type.
  8. Write the result.
    go run scripts/openapi-compat/v5names.go -old $S/v522/pkg/openapi -report $S/report.md \
        -write -test pkg/gorp/openapi_compat_v5_test.go
    diff scripts/openapi-compat/compat.go.tmpl pkg/openapi/compat.go   # no output
    git status --short                                                   # no output on this branch
    A line that would exceed 140 columns after gofmt alignment (PageClusterInfoResource) is put in its own paragraph so that lll passes.
  9. Guard test.
    sed -i '' '/^	Issue  *= ComEpam/d' pkg/openapi/compat.go   # BSD sed; the pattern starts with a tab
    go vet ./pkg/gorp/                                          # undefined: openapi.Issue
    git checkout pkg/openapi/compat.go
  10. Consumer check with a control.
    git fetch origin pull/15/head:pr15-check && git rev-parse --short pr15-check   # 07ad5c4
    mkdir -p $S/consumer/master
    git archive pr15-check pkg/ginkgo | tar -x -C $S/consumer
    git archive origin/master | tar -x -C $S/consumer/master
    BRANCH=$PWD && cd $S/consumer
    printf 'go 1.27.0\n\nuse (\n\t./pkg/ginkgo\n\t./master\n)\n' > go.work
    (cd pkg/ginkgo && go list -m -f '{{.Dir}}' github.com/reportportal/goRP/v5 && go build ./...)
    # fails: 3x undefined: openapi.ParameterResource, 1x undefined: openapi.Issue
    printf 'go 1.27.0\n\nuse (\n\t./pkg/ginkgo\n\t%s\n)\n' "$BRANCH" > go.work
    (cd pkg/ginkgo && go list -m -f '{{.Dir}}' github.com/reportportal/goRP/v5 && go build ./... && go vet ./...)
    # passes
    go list -m prints the goRP directory the workspace resolves, so the pass does not come from the v5.2.2 that pkg/ginkgo/go.mod pins.
  11. Checks. go build ./... && go vet ./... && go test ./..., then task fmt and task lint.

🤖 Generated with Claude Code

After the OpenAPI regeneration, 137 of the 186 model type names that
pkg/openapi exported at v5.2.2 were gone, while the module path is
still /v5. Code written against v5.2.2 (for example the Ginkgo agent
in #15, which uses openapi.Issue and openapi.ParameterResource) no
longer compiled.

Restore 116 of them as type aliases in compat.go. The block is
generated by scripts/openapi-compat/v5names.go. 114 aliases are
emitted because exactly one schema key in reportportal-api-docs.json
has the v5.2.2 class name; 2 (ItemAttributeResource,
PagedLogResourcePagesLocationInner) because every field that used the
name now uses one and the same type. In both cases the JSON fields of
the v5.2.2 struct must still be present. 21 names are not restored
(18 have no counterpart, 3 lost JSON fields).

pkg/gorp/openapi_compat_v5_test.go is a generated compile-level check
of every restored and previously aliased name and its field types.

Refs #32

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@DzmitryHumianiuk

Copy link
Copy Markdown
Member Author

Note for merging: #33 and #34 conflict at the type level. #34's generated test pins is[*string](v.ErrorCode) (pkg/gorp/openapi_compat_v5_test.go:328), and #33 makes the field *int64. Whichever PR merges second must rerun go run scripts/openapi-compat/v5names.go … -write -test pkg/gorp/openapi_compat_v5_test.go. A follow-up that builds one error type for both clients (status plus server code and message, OAuth 401 bodies) will be stacked on #33.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants