-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat(clients-national-registry-v3-applications): Add new client #17807
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces a new National Registry V3 Applications client library. It adds a Codeowners entry to assign ownership to a designated team and incorporates various configuration files (ESLint, Jest, Nx project, and TypeScript) along with source code files for API configuration, module definition, service implementations, and provider setup. Additionally, it updates the TypeScript base configuration with a new path mapping for the client library. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🌐 Web search-backed reviews and chat
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.service.ts (1)Pattern
📓 Learnings (1)libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.service.ts (2)
🔇 Additional comments (1)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
clientId: env.required( | ||
'NATIONAL_REGISTRY_B2C_CLIENT_ID', | ||
'b464afdd-056b-406d-b650-6d41733cfeb7', | ||
), | ||
clientSecret: env.required('NATIONAL_REGISTRY_B2C_CLIENT_SECRET', ''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the api provider, the clientId and secret are unaltered for this service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (1)
libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.config.ts (1)
16-38
: Remove extra space in the name property.There's an extra space at the beginning of the name property.
Apply this diff to fix the name property:
- name: ' NationalRegistryV3ApplicationsClient', + name: 'NationalRegistryV3ApplicationsClient',
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
.github/CODEOWNERS
(1 hunks)libs/clients/national-registry/v3-applications/.eslintrc.json
(1 hunks)libs/clients/national-registry/v3-applications/README.md
(1 hunks)libs/clients/national-registry/v3-applications/jest.config.ts
(1 hunks)libs/clients/national-registry/v3-applications/project.json
(1 hunks)libs/clients/national-registry/v3-applications/src/clientConfig.json
(1 hunks)libs/clients/national-registry/v3-applications/src/index.ts
(1 hunks)libs/clients/national-registry/v3-applications/src/lib/apiConfig.ts
(1 hunks)libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.config.ts
(1 hunks)libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.module.ts
(1 hunks)libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.service.ts
(1 hunks)libs/clients/national-registry/v3-applications/src/lib/providers.ts
(1 hunks)libs/clients/national-registry/v3-applications/tsconfig.json
(1 hunks)libs/clients/national-registry/v3-applications/tsconfig.lib.json
(1 hunks)libs/clients/national-registry/v3-applications/tsconfig.spec.json
(1 hunks)tsconfig.base.json
(1 hunks)
✅ Files skipped from review due to trivial changes (5)
- libs/clients/national-registry/v3-applications/README.md
- libs/clients/national-registry/v3-applications/tsconfig.lib.json
- libs/clients/national-registry/v3-applications/tsconfig.json
- libs/clients/national-registry/v3-applications/jest.config.ts
- libs/clients/national-registry/v3-applications/.eslintrc.json
🧰 Additional context used
📓 Path-based instructions (9)
libs/clients/national-registry/v3-applications/tsconfig.spec.json (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/src/lib/apiConfig.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.module.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/src/lib/providers.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.config.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/src/index.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/project.json (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.service.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/clients/national-registry/v3-applications/src/clientConfig.json (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
🪛 Biome (1.9.4)
libs/clients/national-registry/v3-applications/src/index.ts
[error] 3-3: Useless rename.
Safe fix: Remove the renaming.
(lint/complexity/noUselessRename)
🔇 Additional comments (17)
libs/clients/national-registry/v3-applications/src/lib/providers.ts (1)
4-10
: LGTM! Well-structured provider configuration.The provider setup follows NestJS best practices for dependency injection and maintains type safety.
libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.module.ts (1)
6-14
: LGTM! Well-structured NestJS module.The module follows NestJS best practices for dependency injection and exports.
libs/clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.config.ts (2)
4-11
: LGTM!The schema definition is well-structured and includes all necessary properties with appropriate types.
13-15
: LGTM!The configuration type is correctly defined using zod inference.
libs/clients/national-registry/v3-applications/src/lib/apiConfig.ts (2)
1-5
: LGTM!All necessary dependencies are correctly imported.
7-33
: LGTM!The API configuration is well-structured and follows NestJS dependency injection pattern. The fetch API is properly configured with timeout, authentication, and headers.
.github/CODEOWNERS (1)
181-181
: LGTM!The ownership assignment correctly assigns the v3-applications directory to the @island-is/juni team, aligning with the PR objectives.
libs/clients/national-registry/v3-applications/tsconfig.spec.json (3)
1-2
: LGTM!The configuration correctly extends the base tsconfig.json.
3-7
: LGTM!The compiler options are correctly configured for testing with Jest.
8-19
: LGTM!The file inclusion patterns correctly include all necessary test files and type definitions.
libs/clients/national-registry/v3-applications/project.json (5)
1-7
: Project Metadata and Basic Configuration:
The project’s metadata (name, schema, sourceRoot, projectType, and tags) is clearly defined and follows the standard Nx configuration format. This sets a solid foundation for the new client library.
8-10
: Lint Target Configuration:
The lint target is properly set up using the@nx/eslint:lint
executor. This is consistent with best practices and helps ensure code quality.
11-19
: Test Target Setup:
The testing target is configured to use Jest with a specified output directory for coverage reports and a clear reference to the project’s Jest configuration file. This configuration looks robust and in line with standard practices.
20-31
: Update OpenAPI Document Command:
This target executes a series of shell commands to fetch, modify, and format the OpenAPI document. The command on line 24 uses nestedcurl
calls to obtain a Bearer token dynamically, then pipes the response throughjq
andprettier
. While the approach is technically sound, its complexity could affect maintainability.
- Recommendation: Ensure that the required environment variables (
NAT_REG_CLIENT_ID
andNAT_REG_CLIENT_SECRET
) are always provided in the execution environment.- Suggestion: Consider refactoring this multi-step command into a dedicated script for improved readability and easier troubleshooting.
32-38
: Backend Client Code Generation Command:
The command to generate the backend client usingyarn openapi-generator
is straightforward and aligns with the project’s configuration targets. Double-check that theopenapi-generator
tool is available and properly configured to generate files in the specified output directory.libs/clients/national-registry/v3-applications/src/clientConfig.json (1)
1-1247
: Comprehensive OpenAPI Specification:
The OpenAPI specification for the MidlunUmsoknirRestApi is extensive and well-organized. It clearly defines various endpoints (e.g.,/Einstaklingar/{kennitala}
,/Einstaklingar/{kennitala}/faedingarstadur
, etc.) with appropriate HTTP response codes, tags, and $ref pointers to detailed component schemas. The strict use of"additionalProperties": false
on schemas ensures that responses strictly adhere to the defined contracts.
- Note: Verify that all
$ref
references (such as#/components/schemas/EinstaklingurDTO
) resolve correctly in the consuming code or during code generation.tsconfig.base.json (1)
738-740
: New Path Mapping Addition:
The new path mapping for@island.is/clients/national-registry-v3-applications
pointing tolibs/clients/national-registry/v3-applications/src/index.ts
has been correctly added. This change will enable simpler and more consistent imports from the new client library and aligns seamlessly with the existing path mappings.
.../clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.service.ts
Outdated
Show resolved
Hide resolved
.../clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.service.ts
Show resolved
Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
View your CI Pipeline Execution ↗ for commit 656fb9a.
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one comment, otherwise LGTM
.../clients/national-registry/v3-applications/src/lib/nationalRegistryV3Applications.service.ts
Outdated
Show resolved
Hide resolved
…om:/island-is/island.is into feat/national-registry-applications-client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, approved 👍
The National Registrar has created a new service in X-Road called
MidlunUmsoknir-v1
.This client is very similar to
clients-national-registry-v3
.On naming
I've come up with
national-registry-v3-applications
, partly for a lack of imagination and partly because this isn't really a version 4 but a separate client. Feel free to advise on the name, however, since it is rather long.Checklist:
Summary by CodeRabbit