Skip to content

Ref(api-specification): refactoring folder structure for occupation group relations api-specification definetion#483

Open
C5rogers wants to merge 2 commits intomainfrom
fix/refactoring_folder_structure_for_occupation_group_api_specification
Open

Ref(api-specification): refactoring folder structure for occupation group relations api-specification definetion#483
C5rogers wants to merge 2 commits intomainfrom
fix/refactoring_folder_structure_for_occupation_group_api_specification

Conversation

@C5rogers
Copy link

@C5rogers C5rogers commented Mar 4, 2026

  • This pull request have a change on the api-specification of OccupationGroup for relations api separeting based on there hierarchy

…roup relations api-specification definetion
@C5rogers C5rogers self-assigned this Mar 4, 2026
@C5rogers C5rogers added the documentation Improvements or additions to documentation label Mar 4, 2026
@C5rogers C5rogers requested a review from Copilot March 4, 2026 08:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the api-specifications for OccupationGroup relation endpoints by splitting relation-specific pieces into relations/parent and relations/children folders and updating imports/exports accordingly.

Changes:

  • Update relation schema/test imports to reflect the new relations/* folder structure.
  • Add new relation-specific enum modules (relations/parent/enum.ts, relations/children/enum.ts) and export them from occupationGroup/index.ts.
  • Update the occupationGroup module export snapshot to include the new enum exports.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
backend/globalConfig.json Adds a hard-coded local MongoDB URI config file.
api-specifications/src/esco/occupationGroup/relations/parent/schema.GET.parent.response.ts Fixes _baseResponseSchema import path after moving under relations/parent.
api-specifications/src/esco/occupationGroup/relations/parent/schema.GET.parent.response.test.ts Updates imports to reference occupationGroup root module/enums/regex after refactor.
api-specifications/src/esco/occupationGroup/relations/parent/enum.ts Introduces parent-relation enum namespace and error codes.
api-specifications/src/esco/occupationGroup/relations/children/schema.GET.child.response.ts Fixes _baseChildrenResponseSchema import path after moving under relations/children.
api-specifications/src/esco/occupationGroup/relations/children/schema.GET.child.response.test.ts Updates imports to reference occupationGroup root module/enums/regex after refactor.
api-specifications/src/esco/occupationGroup/relations/children/enum.ts Introduces children-relation enum namespace and error codes.
api-specifications/src/esco/occupationGroup/index.ts Exposes moved schemas and newly added ParentEnums/ChildrenEnums via the main module export.
api-specifications/src/esco/occupationGroup/snapshots/index.test.ts.snap Snapshot update to include the new exported enum namespaces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1 @@
{"mongoUri":"mongodb://127.0.0.1:24780/"} No newline at end of file
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backend/globalConfig.json introduces a hard-coded local MongoDB URI. This file doesn’t appear to be referenced anywhere in backend/src (config is read from env elsewhere), and committing environment-specific connection strings can cause confusion in CI/prod. Consider removing this file from the repo (or replacing it with a documented example like globalConfig.example.json) and loading the URI from environment variables; if it must exist locally, add it to .gitignore.

Suggested change
{"mongoUri":"mongodb://127.0.0.1:24780/"}
{"mongoUri":"YOUR_MONGODB_URI_HERE"}

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +23

namespace OccupationGroupParentEnums {
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
}
export namespace Relations {
export namespace Parent {
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
}
}
export namespace Children {
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
ESCOOccupation = CommonGroupTypes.ESCOOccupation,
LocalOccupation = CommonGroupTypes.LocalOccupation,
}
}
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new file duplicates constants already defined in api-specifications/src/esco/occupationGroup/enums.ts (e.g., Relations.Parent.ObjectTypes and Relations.Children.ObjectTypes) and also duplicates Relations.Children.ObjectTypes again in OccupationGroupChildrenEnums. Having multiple sources of truth for the same enum values/error codes is likely to drift over time. Consider consolidating to a single definition (e.g., export the relation enums from one module and import/re-export them where needed) and removing the duplicated enum blocks here.

Suggested change
namespace OccupationGroupParentEnums {
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
}
export namespace Relations {
export namespace Parent {
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
}
}
export namespace Children {
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
ESCOOccupation = CommonGroupTypes.ESCOOccupation,
LocalOccupation = CommonGroupTypes.LocalOccupation,
}
}
}
import OccupationGroupEnums from "../../enums";
namespace OccupationGroupParentEnums {
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
}
export import Relations = OccupationGroupEnums.Relations;

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
import { ObjectTypes as CommonGroupTypes } from "../../../common/objectTypes";

namespace OccupationGroupChildrenEnums {
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename enum.ts is inconsistent with the existing convention in this repo for enum modules (commonly enums.ts, including other relation enum modules). Renaming to enums.ts would improve discoverability and consistency across api-specifications/src/esco/**/relations/** folders.

Copilot uses AI. Check for mistakes.
Comment on lines 56 to +63
namespace OccupationGroupAPISpecs {
export import Enums = OccupationGroupEnums;
export import Types = OccupationGroupTypes;
export import Constants = OccupationGroupConstants;
export import Schemas = OccupationGroupSchemas;
export import Patterns = OccupationGroupRegexes;
export import ParentEnums = OccupationGroupParentEnums;
export import ChildrenEnums = OccupationGroupChildrenEnums;
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OccupationGroupAPISpecs now exports both Enums (which already contains Relations.Parent/Children enums) and the new ParentEnums/ChildrenEnums. This creates two parallel public enum hierarchies for the same concepts, which is easy for API consumers to misuse and hard to keep in sync. Consider either (1) moving the relation enums out of ./enums.ts and re-exporting them from a single place, or (2) not exporting ParentEnums/ChildrenEnums and keeping Enums.Relations.* as the only supported path.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
{"mongoUri":"mongodb://127.0.0.1:24780/"} No newline at end of file
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change adds backend/globalConfig.json, but the PR description is about refactoring the api-specifications folder structure for OccupationGroup relations. If globalConfig.json is unrelated, it should be removed from this PR to keep the change scoped and easier to review.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file, should not be commited

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +16
export enum ErrorCodes {
INVALID_LIMIT_PARAMETER = "INVALID_LIMIT_PARAMETER",
INVALID_NEXT_CURSOR_PARAMETER = "INVALID_NEXT_CURSOR_PARAMETER",
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OccupationGroupParentEnums duplicates values that already exist in OccupationGroupEnums (e.g. object types and the shared 400 error codes). This creates a drift risk if one set is updated without the other. Prefer re-exporting the existing enums (or a shared/common enum) instead of redefining the same members here.

Suggested change
export enum ErrorCodes {
INVALID_LIMIT_PARAMETER = "INVALID_LIMIT_PARAMETER",
INVALID_NEXT_CURSOR_PARAMETER = "INVALID_NEXT_CURSOR_PARAMETER",
}
export import ErrorCodes = OccupationGroupEnums.GET.Response.Status400.ErrorCodes;

Copilot uses AI. Check for mistakes.
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
}
export import Relations = OccupationGroupEnums.Relations;
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export import Relations = OccupationGroupEnums.Relations; re-exports all relation enums (including children) from within the parent-specific enum module, which makes this module’s API broader and potentially misleading. Consider removing this re-export or narrowing it to only the parent-related types so ParentEnums stays focused on the parent relation.

Suggested change
export import Relations = OccupationGroupEnums.Relations;

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +16
export enum ObjectTypes {
ISCOGroup = CommonGroupTypes.ISCOGroup,
LocalGroup = CommonGroupTypes.LocalGroup,
ESCOOccupation = CommonGroupTypes.ESCOOccupation,
LocalOccupation = CommonGroupTypes.LocalOccupation,
}
export namespace GET {
export namespace Response {
export namespace Status400 {
export enum ErrorCodes {
INVALID_LIMIT_PARAMETER = "INVALID_LIMIT_PARAMETER",
INVALID_NEXT_CURSOR_PARAMETER = "INVALID_NEXT_CURSOR_PARAMETER",
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OccupationGroupChildrenEnums repeats enum members that already exist in OccupationGroupEnums.Relations.Children.ObjectTypes and the shared 400 error codes. Duplicating these constants across modules increases maintenance overhead and can lead to inconsistent values over time. Prefer re-exporting from a single source of truth where possible.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants