Skip to content

Commit f5e3191

Browse files
committed
Initial code drop
1 parent d0e43de commit f5e3191

File tree

107 files changed

+277663
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+277663
-1
lines changed

.eslintrc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"es2020": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"ignorePatterns": [
12+
"dist",
13+
".eslintrc.cjs"
14+
],
15+
"parser": "@typescript-eslint/parser",
16+
"rules": {
17+
"curly": "error",
18+
"@typescript-eslint/no-explicit-any": "off",
19+
"@typescript-eslint/no-unused-vars": "off",
20+
"@typescript-eslint/ban-types": [
21+
"error",
22+
{
23+
"types": {
24+
"{}": false
25+
},
26+
"extendDefaults": true
27+
}
28+
]
29+
}
30+
}

.gitattributes

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
*.js text eol=lf
2+
*.ts text eol=lf
3+
*.md text eol=lf
4+
*.yaml text eol=lf
5+
*.html text eol=lf
6+
*.json text eol=lf
7+
*.sh text eol=lf
8+
*.svg text eol=lf
9+
*.cjs text eol=lf
10+
.browserslistrc text eol=lf
11+
*.mp4 binary
12+
*.png binary
13+
*.jpg binary
14+
*.gif binary
15+
*.vsdx binary
16+
*.ttf binary
17+
*.eot binary
18+
*.woff binary
19+
*.woff2 binary
20+
.gitignore text eol=lf
21+
.npmignore text eol=lf
22+
.gitattributes text eol=lf
23+
LICENSE eol=lf
24+
NOTICE eol=lf

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules/
2+
.env
3+
.vscode
4+
dist/
5+
.vuepress
6+
temp/
7+
browser
8+
coverage/
9+
.DS_store
10+
package-lock.json
11+
.yarnrc.yml
12+
.yarn
13+
*.iml
14+
/.idea/

CODE-OF-CONDUCT.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Code of Conduct
2+
3+
This repository is governed by following code of conduct guidelines.
4+
5+
We put collaboration, trust, respect and transparency as core values for our community.
6+
Our community welcomes participants from all over the world with different experience,
7+
opinion and ideas to share.
8+
9+
We have adopted this code of conduct and require all contributors to agree with that to build a healthy,
10+
safe and productive community for all.
11+
12+
The guideline is aimed to support a community where all people should feel safe to participate,
13+
introduce new ideas and inspire others, regardless of:
14+
15+
* Age
16+
* Gender
17+
* Gender identity or expression
18+
* Family status
19+
* Marital status
20+
* Ability
21+
* Ethnicity
22+
* Race
23+
* Sex characteristics
24+
* Sexual identity and orientation
25+
* Education
26+
* Native language
27+
* Background
28+
* Caste
29+
* Religion
30+
* Geographic location
31+
* Socioeconomic status
32+
* Personal appearance
33+
* Any other dimension of diversity
34+
35+
## Our Standards
36+
37+
We are welcoming the following behavior:
38+
39+
* Be respectful for different ideas, opinions and points of view
40+
* Be constructive and professional
41+
* Use inclusive language
42+
* Be collaborative and show the empathy
43+
* Focus on the best results for the community
44+
45+
The following behavior is unacceptable:
46+
47+
* Violence, threats of violence, or inciting others to commit self-harm
48+
* Personal attacks, trolling, intentionally spreading misinformation, insulting/derogatory comments
49+
* Public or private harassment
50+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
51+
* Derogatory language
52+
* Encouraging unacceptable behavior
53+
* Other conduct which could reasonably be considered inappropriate in a professional community
54+
55+
## Our Responsibilities
56+
57+
Project maintainers are responsible for clarifying the standards of the Code of Conduct
58+
and are expected to take appropriate actions in response to any instances of unacceptable behavior.
59+
60+
Project maintainers have the right and responsibility to remove, edit, or reject comments,
61+
commits, code, wiki edits, issues, and other contributions that are not aligned
62+
to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors
63+
that they deem inappropriate, threatening, offensive, or harmful.
64+
65+
## Reporting
66+
67+
If you believe you’re experiencing unacceptable behavior that will not be tolerated as outlined above,
68+
please report to `[email protected]`. All complaints will be reviewed and investigated and will result in a response
69+
that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality
70+
with regard to the reporter of an incident.
71+
72+
Please also report if you observe a potentially dangerous situation, someone in distress, or violations of these guidelines,
73+
even if the situation is not happening to you.

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contribution Guide
2+
3+
We'd love to accept patches and contributions to this project.
4+
Please, follow these guidelines to make the contribution process easy and effective for everyone involved.
5+
6+
## Contributor License Agreement
7+
8+
You must sign the [Contributor License Agreement](https://pages.netcracker.com/cla-main.html) in order to contribute.
9+
10+
## Code of Conduct
11+
12+
Please make sure to read and follow the [Code of Conduct](CODE-OF-CONDUCT.md).
13+

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Apache License
23
Version 2.0, January 2004
34
http://www.apache.org/licenses/

NOTICE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
qubership-apihub-api-unifier
2+
Copyright 2024-2025 NetCracker Technology Corporation
3+
4+
This product includes software developed by https://github.com/udamir
5+
https://github.com/udamir/allof-merge
6+
MIT License
7+
Copyright (c) 2022 Damir Yusipov

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
# qubership-apihub-api-unifier
1+
# qubership-apihub-api-unifier
2+
3+
Unify API into a normalized presentation with all reference resolved, allOf combiners merged and other aspects unified.
4+
5+
Supports OpenAPI and GraphQL specifications processing.
6+
7+
## Modifications
8+
Modified version of [udamir/allof-merge](https://github.com/udamir/allof-merge)
9+
10+
- Added cycles support during combiners resolve
11+
- Added origins support- it is now possible for any value in the unified JSO to track its origins in the source specification
12+
- Store original ref for the object if the object was resolved from ref
13+
- Gathered various API unification adapters from different libraries in the stack to a single place
14+
- Support data structure hash calculation
15+
- Process different phases sequentially (reference resolving, allOf merge, unification)
16+
- Support synthetic `any` and `nothing` type for OAS
17+
- Added deprecated items calculation
18+
- Support new graphapi format
19+
- Feature flags added to control behavior during processing
20+
- Added a large number of tests
21+
- Debug tooling for cycled JSO
22+
23+
## Features
24+
- Safe merging of schemas combined with allOf in whole document
25+
- Fastest implementation - up to x3 times faster then other popular libraries
26+
- Merged schema does not validate more or less than the original schema
27+
- Removes almost all logical impossibilities
28+
- Correctly merge additionalProperties, patternProperties and properties taking into account common validations
29+
- Correctly merge items and additionalItems taking into account common validations
30+
- Supports custom rules to merge other document types and JsonSchema versions
31+
- Supports input with circular references (javaScript references)
32+
- Supports $refs and circular $refs either (internal references only)
33+
- Correctly merge of $refs with sibling content (optionally)
34+
- Correctly merge of combiners (anyOf, oneOf) with sibling content (optionally)
35+
- Typescript syntax support out of the box
36+
- No dependencies (except json-crawl), can be used in NodeJS or browser
37+
38+
## Works perfectly with specifications:
39+
40+
- [JsonSchema](https://json-schema.org/draft/2020-12/json-schema-core.html)
41+
- [OpenApi 3.x](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md)
42+
- GraphApi
43+
- ~~Swagger 2.x~~ (roadmap)
44+
- ~~AsyncApi 2.x~~ (roadmap)
45+
- ~~AsyncApi 3.x~~ (roadmap)
46+
47+
## Other libraries
48+
There are some libraries that can merge schemas combined with allOf. One of the most popular is [mokkabonna/json-schema-merge-allof](https://www.npmjs.com/package/json-schema-merge-allof), but it has some limitatons: Does not support circular $refs and no Typescript syntax out of the box.
49+
50+
## External $ref
51+
If schema contains an external $ref, you should bundle it via [api-ref-bundler](https://github.com/udamir/api-ref-bundler) first.

SECURITY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Security Reporting Process
2+
3+
Please, report any security issue to `[email protected]` where the issue will be triaged appropriately.
4+
5+
If you know of a publicly disclosed security vulnerability please IMMEDIATELY email `[email protected]`
6+
to inform the team about the vulnerability, so we may start the patch, release, and communication process.
7+
8+
# Security Release Process
9+
10+
If the vulnerability is found in the latest stable release, then it would be fixed in patch version for that release.
11+
E.g., issue is found in 2.5.0 release, then 2.5.1 version with a fix will be released.
12+
By default, older versions will not have security releases.
13+
14+
If the issue doesn't affect any existing public releases, the fix for medium and high issues is performed
15+
in a main branch before releasing a new version. For low priority issues the fix can be planned for future releases.
16+

jest.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
setupFilesAfterEnv: ['jest-extended/all'],
3+
transform: {
4+
'^.+\\.tsx?$': 'ts-jest',
5+
},
6+
testRegex: '(/tests/.*|(\\.|/)(test|spec))\\.(ts?|tsx?|js?|jsx?)$',
7+
moduleFileExtensions: [
8+
'ts',
9+
'tsx',
10+
'js',
11+
'jsx',
12+
'json',
13+
'node',
14+
],
15+
modulePathIgnorePatterns: [
16+
'<rootDir>/dist/',
17+
],
18+
// moduleNameMapper:{
19+
// "^@netcracker/qubership-apihub-json-crawl$":'<rootDir>/../qubership-apihub-json-crawl/src',
20+
// "^@netcracker/qubership-apihub-graphapi$":'<rootDir>/../qubership-apihub-graphapi/src',
21+
// },
22+
collectCoverage: true,
23+
}

0 commit comments

Comments
 (0)