Compare commits
498 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3526dc807 | |||
a24abad7ad | |||
ef92254b99 | |||
0ef755a0f4 | |||
1d16bcccd6 | |||
90d78a1898 | |||
797fdabf5d | |||
140130fd34 | |||
b449545460 | |||
8f711bbd62 | |||
1d0d18b254 | |||
e021efd8f2 | |||
97a46ae8c6 | |||
f7b90bc795 | |||
99b9addb00 | |||
b452d95764 | |||
641ab78ebd | |||
60aa7b885a | |||
9fcb591795 | |||
1a70e66daf | |||
afc69f447d | |||
0fbf7361d0 | |||
05bf4475cc | |||
bdea0de2c5 | |||
d0c91d1ec1 | |||
819739d7f1 | |||
6ccefae81c | |||
6b7c789dd2 | |||
054f6aad44 | |||
958beb1b9c | |||
a0489d4a00 | |||
20cdf6bcad | |||
803d1c5451 | |||
b9b26ea8eb | |||
08c7ad08bc | |||
506372b74c | |||
29a38f72b8 | |||
fd1996bdd4 | |||
2084828eec | |||
417e21c0a7 | |||
641c995171 | |||
a7d6b0dd70 | |||
c9eb45ff1d | |||
38081606f3 | |||
4562c8f7e5 | |||
0e2f7acb24 | |||
636bf65c36 | |||
4a9165fd3a | |||
c2ce172024 | |||
d94eae93ad | |||
f874cb74e3 | |||
9bd3b2e1e6 | |||
0958d5a874 | |||
c53c0b045d | |||
fb0d3bb1dd | |||
1580d679d0 | |||
540dad1f00 | |||
21f922a296 | |||
fa7b1e5833 | |||
35110e8ad4 | |||
18d64a2ed1 | |||
4ffb04976a | |||
76b6288216 | |||
80f6f28b57 | |||
bf8b2b40f6 | |||
7c6826b366 | |||
ee56c8023e | |||
01c4e0558d | |||
a760121af5 | |||
b80ff3a998 | |||
8141be4b21 | |||
7fbc2523e2 | |||
3349e9dab7 | |||
da8439e1b7 | |||
e2d7d16571 | |||
f348910b63 | |||
7ed4c8075b | |||
87ba80b6bb | |||
e10f3b4c47 | |||
a7853ce353 | |||
da654e5664 | |||
d21434fdd0 | |||
8a94f6e498 | |||
7a58914466 | |||
2da6088303 | |||
1ad82f7e8e | |||
6117443c8b | |||
f8e098eb07 | |||
e2affe3f4b | |||
a78b51be07 | |||
fa96923a5a | |||
464fa2d98a | |||
11e0d248b5 | |||
2612010a88 | |||
cb78d19b89 | |||
28bce9c443 | |||
d7dad48808 | |||
2ea97ba2c2 | |||
944c632a1d | |||
d1c52c010e | |||
d9f78b4e9f | |||
dcde50de0a | |||
889fdb41d7 | |||
837108bbef | |||
ee9e3b03b3 | |||
3cc6e9f2e7 | |||
60eb3b6474 | |||
65c0137a46 | |||
c277e559f4 | |||
8a161466d6 | |||
9a4ad2f737 | |||
eb4d3ca7de | |||
7a8bb43675 | |||
ac464ea9ca | |||
c7545b1072 | |||
353637bb94 | |||
3d1fc566d4 | |||
79ddb2e4ae | |||
d004166a2e | |||
dc6dbdf1c0 | |||
0b9b8325ce | |||
6d89773448 | |||
b236530991 | |||
8caee55f43 | |||
13042ba385 | |||
26bd7178c9 | |||
9bc39e9767 | |||
57555587e0 | |||
47a9f0a145 | |||
789b750994 | |||
65fb7fbd55 | |||
89bd9dadd0 | |||
6ca8261cd2 | |||
ae5ddc35e6 | |||
dde9e1c0a7 | |||
8328351227 | |||
36a09ef3ca | |||
261e91a750 | |||
701ab7670e | |||
62280435cd | |||
18ddb13625 | |||
b5b2e462ac | |||
1bb52347a0 | |||
80f8ce6e52 | |||
1f504e8850 | |||
18d545bbfe | |||
e03868c42e | |||
e888207773 | |||
66943ceb5a | |||
e9342b9354 | |||
480b1ccdff | |||
95009090ba | |||
10ce370c9e | |||
1814fe4eb2 | |||
b0387313fd | |||
86c4800748 | |||
01052268f8 | |||
5c6f2c93e8 | |||
ccd46b15e7 | |||
eab1bb4ce7 | |||
3fdfe875f4 | |||
1b3cf0dbeb | |||
2410c81797 | |||
833bf463e7 | |||
b7e96019be | |||
aa5eb39a30 | |||
d002ec7fd9 | |||
650eb0f0d3 | |||
1a4568a49b | |||
f2786fec08 | |||
904cc6816d | |||
a06821a910 | |||
a9dffcf8a5 | |||
548b1ff4bc | |||
6f85ee476a | |||
326bbb4419 | |||
438eb52dc8 | |||
1fd59db4e1 | |||
238e372460 | |||
473e2c22af | |||
7fb7e688ac | |||
9f2c27aa0f | |||
dc762d1d3e | |||
b039803246 | |||
6ec240d7cd | |||
dd57347b90 | |||
43c8fd1338 | |||
6c2725680e | |||
84dfe4e6fe | |||
a0c1abf011 | |||
25820d0920 | |||
7c18283ac8 | |||
c5f3b7fa8b | |||
8b81010d72 | |||
c07ffa6a14 | |||
7793908ab6 | |||
bf6d08c2bd | |||
68bae4918e | |||
592c116c3b | |||
c7fe5c288f | |||
e059633055 | |||
884a50fc83 | |||
588e52c9df | |||
f49fcb2a22 | |||
0a9475a7ab | |||
f8fbb7ad25 | |||
f792fb5d1f | |||
845d1a971d | |||
9396b2ecfe | |||
d74b7b3f28 | |||
e783630845 | |||
d907ba004a | |||
5c7ec4fdb4 | |||
097413067b | |||
eb7360b8d2 | |||
3ec467c1d8 | |||
152476c26e | |||
c4df4c7b2c | |||
87fa0b5602 | |||
53c76d6037 | |||
44324ca3a4 | |||
9364fb19e4 | |||
ca1f632665 | |||
9bb3184735 | |||
9a139b5713 | |||
9861c8e258 | |||
02f8ed04f2 | |||
3e23939386 | |||
d0575944db | |||
ccc81c2813 | |||
e8da52fd75 | |||
34c14e26da | |||
209b5e38a3 | |||
902faa9471 | |||
c7ef70a844 | |||
f83c3d203d | |||
bd05dbcfcb | |||
cb5c0e71a3 | |||
a209cafa74 | |||
3d27d30a31 | |||
8cc229667e | |||
54d12de67a | |||
9b93c887a2 | |||
19d828956b | |||
eabe90acfc | |||
7c2a2a9c9d | |||
15cdfb229d | |||
5a40f37f81 | |||
64f2516f19 | |||
2e5e39d3b2 | |||
5342cf00d1 | |||
8c0b658033 | |||
b7b1171685 | |||
1f730869a8 | |||
377a60614e | |||
e34bea1769 | |||
91bf93a866 | |||
73fb8b137f | |||
d3d6e79329 | |||
f2b7d924e0 | |||
f62010b4e7 | |||
5bd1534270 | |||
4c151ffeea | |||
08a0d2e47c | |||
f19476d3a3 | |||
8ede53fd5c | |||
31a9f44ec1 | |||
0eb2f126b3 | |||
0d658bd6a8 | |||
e924671c2b | |||
04996631b9 | |||
82d80873c8 | |||
487eaba741 | |||
b935cc1e1d | |||
9f2d2dd4e3 | |||
20f8a4f08f | |||
7b39e448bf | |||
3c57c8f5e4 | |||
01b6b59cf5 | |||
2c1c8fbcdc | |||
0dc2b9538f | |||
1ca7abaf0d | |||
a5376cfa82 | |||
2492661f1f | |||
a7b52ec114 | |||
8ebab04a83 | |||
921f6f9691 | |||
558b9fea62 | |||
752cb238d3 | |||
92d4760dbc | |||
4946a27327 | |||
e4217843b7 | |||
b8f2090a8a | |||
178db951a5 | |||
fa5ada8f64 | |||
4345833b75 | |||
3158195bd9 | |||
70586a7cc6 | |||
6f4e268b91 | |||
a1638f930a | |||
0120feb168 | |||
1da3ad5db9 | |||
a8019bc4f8 | |||
ecf0d42ee1 | |||
d76927ba3c | |||
2c43d4d274 | |||
3111b63916 | |||
1759be5ba3 | |||
622dd6a5e7 | |||
6d6836927f | |||
9109a249e4 | |||
60552b8abb | |||
70345494ab | |||
b3dcf7dc8b | |||
b1aa2e497a | |||
d6b852d297 | |||
42ea128aa3 | |||
8df32d7af6 | |||
3f21879417 | |||
cf238beccb | |||
3b5324ded1 | |||
95ae274f1d | |||
fdcc64d29c | |||
4daf6e000e | |||
ba19389f16 | |||
e43627fa09 | |||
f1d252954b | |||
39d5c8b258 | |||
28b844da6c | |||
76e6b0a278 | |||
8ea6a001c2 | |||
190b3c4abe | |||
52e54b75b9 | |||
07bdeda364 | |||
bf31dd213c | |||
d6d3ca517e | |||
e589d917c8 | |||
196fba790a | |||
4d2c392b05 | |||
db696309c8 | |||
3326f10576 | |||
700cda2f46 | |||
3b50e67ff3 | |||
ee875b6fce | |||
c312b201b3 | |||
0d4b1ddd03 | |||
8ae74705ba | |||
99f5cb5b86 | |||
e89636fa58 | |||
7cd0e6154b | |||
62080f3248 | |||
2007b1bb8c | |||
5beeade430 | |||
2e29b46f0f | |||
90b1f47dbb | |||
c73c9b4605 | |||
48969a8fcc | |||
72b61fa765 | |||
18c2cdf5ae | |||
72af88406c | |||
0a8cf54220 | |||
6f3b97da6c | |||
22dc0b8eea | |||
d61e0f85dd | |||
072858a4f5 | |||
6999f7d2c8 | |||
ab68770e1a | |||
c24cafcaf1 | |||
947a507af9 | |||
95eb39803d | |||
9b55593d8c | |||
a74d2e41a9 | |||
bd15060fb0 | |||
69ceae5b66 | |||
9e8b35d26d | |||
37b8dfffd1 | |||
a3ddffbc5d | |||
c0e84207ed | |||
79d183750c | |||
35b1a829ff | |||
39a67b9786 | |||
d0951e5631 | |||
13fbde1315 | |||
ecd4e03081 | |||
9b2b4c6aa8 | |||
0722b59d87 | |||
6ace967b60 | |||
ddbeb88929 | |||
227e914b7b | |||
3648c69ce4 | |||
ca63d4b0eb | |||
8032e23cce | |||
514fd70e0c | |||
26c481e1a4 | |||
7a1e57f50c | |||
af9197e6b5 | |||
ecd9415662 | |||
cbfdacb596 | |||
ad2ccf92a1 | |||
e520364785 | |||
5de3939b9b | |||
a3dfb09942 | |||
6da21b0cbe | |||
f7473564b9 | |||
6e3f310214 | |||
7c5f30ff50 | |||
371424b3ce | |||
5ba5645201 | |||
8b3444e647 | |||
66473203ba | |||
5fe9fffdee | |||
2364aaa754 | |||
de877d9cbb | |||
f742ea5485 | |||
bae3a16e30 | |||
1355d4dd75 | |||
b5b4795f4c | |||
d5dc41ccf5 | |||
d2dc18fd6a | |||
a0770054ca | |||
1d8e1bc60d | |||
89ac0e19dd | |||
9d972355fd | |||
7cee839119 | |||
d2aa6e84d2 | |||
31fa5e40c8 | |||
f919a6a4b1 | |||
019b2cf4db | |||
64c352064e | |||
c50f7f7ccc | |||
c8f64a50b0 | |||
558824003b | |||
69d6b1af1d | |||
2cebb66134 | |||
52a425a5d2 | |||
21928ba53a | |||
452ab4773f | |||
9bd34c4f97 | |||
99750ccacb | |||
99590563fc | |||
d9cde5b0d8 | |||
2788be53ce | |||
b1bffc6e99 | |||
d1b951b4b1 | |||
71ddc62366 | |||
9bc9ff8085 | |||
c2ea986d3a | |||
d54b8a730f | |||
a2be2c9e93 | |||
cc38391e7c | |||
fbf05b6dcd | |||
ed14c2d01a | |||
c95c525ffb | |||
0ace1efadc | |||
c8595543f9 | |||
94b6a5cea3 | |||
d97717f8f8 | |||
3c585c06a3 | |||
7bfd168d74 | |||
19298f4deb | |||
54bdf107e2 | |||
721302d651 | |||
3ffda43a52 | |||
ae2a1b578a | |||
147c7e7fb0 | |||
906b329c2e | |||
1bf81cfd82 | |||
c9f173d6b0 | |||
c43fafae1b | |||
3b2fa72d26 | |||
91d4ec10b7 | |||
aa1b898b22 | |||
aa21c1219b | |||
bc380077fb | |||
fc9929e9cc | |||
a26ad72b67 | |||
38a70e4979 | |||
4a1425b73b | |||
01c118373e | |||
7535d67661 | |||
eb369dcdc8 | |||
da104d0a63 | |||
c6ed261fe4 | |||
012db5ad26 | |||
f02f7ad211 | |||
c29567114d | |||
d66880f9b2 | |||
5e070e1875 | |||
dd780ad29d | |||
d2165d23bf | |||
d9d0f129b5 | |||
c8d56e62a2 | |||
67bd6ad36f | |||
1a924058a1 | |||
8f81b4d795 | |||
9edd3a53ce | |||
91a6164663 | |||
5a7e052ac4 |
10
.envrc
Normal file
10
.envrc
Normal file
@ -0,0 +1,10 @@
|
||||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
|
||||
fi
|
||||
|
||||
watch_file flake.nix
|
||||
watch_file flake.lock
|
||||
if ! use flake . --impure
|
||||
then
|
||||
echo "Flake could not be used... something is broken :(" >&2
|
||||
fi
|
1
.gitbook.yaml
Normal file
1
.gitbook.yaml
Normal file
@ -0,0 +1 @@
|
||||
root: ./docs/
|
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
17
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Documentation
|
||||
about: Suggest an improvement to the documentation for Kompendium
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Please describe the problem with the current documentation.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Link any docs references**
|
||||
Link to existing docs if incorrect, or references from another project if you have an example.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
5
.github/pull_request_template.md
vendored
5
.github/pull_request_template.md
vendored
@ -11,7 +11,8 @@ Please delete options that are not relevant.
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] This change requires a documentation update
|
||||
- [ ] Documentation
|
||||
- [ ] Chore
|
||||
|
||||
# How Has This Been Tested?
|
||||
|
||||
@ -23,7 +24,7 @@ Please describe the tests that you ran to verify your changes.
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] I have updated the CHANGELOG and bumped the version
|
||||
- [ ] I have updated the CHANGELOG in the `Unreleased` section
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
|
40
.github/workflows/pr_checks.yml
vendored
40
.github/workflows/pr_checks.yml
vendored
@ -4,36 +4,28 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
java-version: '21'
|
||||
- name: Lint
|
||||
uses: burrunan/gradle-cache-action@v2
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
||||
restore-keys: ${{ runner.os }}-gradle
|
||||
- name: Lint using detekt
|
||||
run: ./gradlew detekt
|
||||
gradle-version: wrapper
|
||||
arguments: detekt
|
||||
unit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
java-version: '21'
|
||||
- name: Unit Tests
|
||||
uses: burrunan/gradle-cache-action@v2
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
||||
restore-keys: ${{ runner.os }}-gradle
|
||||
- name: Assemble with Gradle
|
||||
run: ./gradlew assemble
|
||||
- name: Run Unit Tests
|
||||
run: ./gradlew test
|
||||
gradle-version: wrapper
|
||||
arguments: test koverHtmlReport
|
||||
|
26
.github/workflows/publish.yml
vendored
26
.github/workflows/publish.yml
vendored
@ -1,26 +0,0 @@
|
||||
name: Publish to GitHub Packages
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SONATYPE_SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
||||
restore-keys: ${{ runner.os }}-gradle
|
||||
- name: Publish package
|
||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
52
.github/workflows/release.yml
vendored
52
.github/workflows/release.yml
vendored
@ -1,47 +1,29 @@
|
||||
name: Publish to GitHub Packages
|
||||
name: Publish Release
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- prereleased
|
||||
- released
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SONATYPE_SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
|
||||
jobs:
|
||||
publish-to-github:
|
||||
publish-to-maven-central:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
java-version: '21'
|
||||
- name: Publish to Maven Central
|
||||
uses: burrunan/gradle-cache-action@v2
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
||||
restore-keys: ${{ runner.os }}-gradle
|
||||
- name: Publish packages to Github
|
||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository -Prelease=true
|
||||
gradle-version: wrapper
|
||||
arguments: publishAndReleaseToMavenCentral --no-configuration-cache --stacktrace
|
||||
properties: |
|
||||
release=true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish-to-nexus:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
||||
restore-keys: ${{ runner.os }}-gradle
|
||||
- name: Publish packages to Github
|
||||
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Prelease=true
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USER }}
|
||||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
|
||||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_SIGNING_KEY }}
|
||||
# NOTE: FML https://stackoverflow.com/a/39573795
|
||||
ORG_GRADLE_PROJECT_signingInMemoryKeyId: FF618132
|
||||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,7 +1,4 @@
|
||||
# Ignore Gradle project-specific cache directory
|
||||
.gradle
|
||||
|
||||
# Ignore Gradle build output directory
|
||||
build
|
||||
|
||||
.idea
|
||||
.direnv
|
||||
|
@ -1,3 +0,0 @@
|
||||
kotlin 1.5.0-M2
|
||||
java openjdk-14.0.1
|
||||
gradle 7.0
|
782
CHANGELOG.md
782
CHANGELOG.md
@ -1,258 +1,762 @@
|
||||
# Changelog
|
||||
|
||||
## [1.7.0] - August 14th, 2021
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [4.0.3] - 2024-11-11
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Add missing mapping of BooleanEnrichment to EnrichmentHandler
|
||||
|
||||
## [4.0.2] - 2024-11-01
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Resources plugin not published
|
||||
|
||||
## [4.0.1] - 2024-10-31
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update dependency com.charleskorn.kaml:kaml to v0.62.1 (#649)
|
||||
- Maybe actually fixed gradle publishing for real this time??
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Add stacktrace to release workflow
|
||||
|
||||
## [4.0.0-test] - 2024-10-30
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Enriched enrichments (#566)
|
||||
- Add nix flake (#631)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update kotestversion to v5.7.2 (#507)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.24.3 (#510)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.23.1 (#471)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.24.4 (#511)
|
||||
- *(deps)* Update ktor to v2.3.5 (#513)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api-kotlin to v1.3.0 (#515)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-core to v2.21.0 (#518)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api to v2.21.0 (#517)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api to v2.21.1 (#519)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-core to v2.21.1 (#520)
|
||||
- *(deps)* Update ktor to v2.3.5 (#514)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.20 (#526)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.23.2 (#525)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.23.3 (#528)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.25.0 (#530)
|
||||
- *(deps)* Update kotestversion to v5.8.0 (#531)
|
||||
- *(deps)* Update ktor to v2.3.6 (#532)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.6.1 (#533)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.25.1 (#534)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api to v2.22.0 (#535)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-core to v2.22.0 (#536)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.21 (#538)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.23.4 (#540)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.6.2 (#545)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-datetime to v0.5.0 (#546)
|
||||
- *(deps)* Update ktor to v2.3.7 (#547)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.22 (#550)
|
||||
- *(deps)* Update log4j2 monorepo to v2.22.1 (#553)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api-kotlin to v1.4.0 (#554)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.10 (#556)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.10 (#555)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.6 (#557)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.11 (#558)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.11 (#559)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.25.2 (#560)
|
||||
- Enum type def (#563)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.23.5 (#569)
|
||||
- *(deps)* Update ktor to v2.3.8 (#570)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.7 (#573)
|
||||
- *(deps)* Update slf4j monorepo to v2.0.12 (#574)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.25.3 (#575)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.6.3 (#576)
|
||||
- *(deps)* Update log4j2 monorepo to v2.23.0 (#578)
|
||||
- *(deps)* Update ktor to v2.3.9 (#580)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.23 (#584)
|
||||
- *(deps)* Update log4j2 monorepo to v2.23.1 (#585)
|
||||
- *(deps)* Update kotestversion to v5.8.1 (#586)
|
||||
- *(deps)* Update dependency com.charleskorn.kaml:kaml to v0.58.0 (#589)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.23.6 (#591)
|
||||
- *(deps)* Update ktor to v2.3.10 (#593)
|
||||
- *(deps)* Update slf4j monorepo to v2.0.13 (#594)
|
||||
- *(deps)* Update dependency com.charleskorn.kaml:kaml to v0.59.0 (#595)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.24 (#598)
|
||||
- *(deps)* Update ktor to v2.3.11 (#601)
|
||||
- *(deps)* Update kotestversion to v5.9.0 (#603)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-datetime to v0.6.0 (#604)
|
||||
- *(deps)* Update kotestversion to v5.9.1 (#611)
|
||||
- *(deps)* Update ktor to v2.3.12 (#602)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.25 (#623)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.25.4 (#624)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api-kotlin to v1.5.0 (#626)
|
||||
- *(deps)* Update slf4j monorepo to v2.0.14 (#627)
|
||||
- *(deps)* Update slf4j monorepo to v2.0.15 (#628)
|
||||
- *(deps)* Update slf4j monorepo to v2.0.16 (#629)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-datetime to v0.6.1 (#633)
|
||||
- *(deps)* Update log4j2 monorepo to v2.24.0 (#634)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.23.7 (#635)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.13.0 (#637)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.25.5 (#638)
|
||||
- *(deps)* Update log4j2 monorepo to v2.24.1 (#641)
|
||||
- *(deps)* Update dependency com.charleskorn.kaml:kaml to v0.62.0 (#614)
|
||||
- *(deps)* Update ktor to v3.0.1 (#647)
|
||||
- On the path to fixing publishing to maven central (#648)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Update docs for 4.0 release (#567)
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Enable k2 compiler (#529)
|
||||
- Bump sourdough (#562)
|
||||
- Yaml example (#564)
|
||||
- Rollback docs due to sonatype disaster (#581)
|
||||
- Add test suffix to version for now
|
||||
|
||||
### Major
|
||||
|
||||
- Ktor 3.0.0 support - fixes #644 (#645)
|
||||
|
||||
## [4.0.0-alpha] - 2023-09-04
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.8.22 (#477)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.23.3 (#478)
|
||||
- *(deps)* Update ktor to v2.3.2 (#480)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.0 (#484)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.23.4 (#485)
|
||||
- *(deps)* Update ktor to v2.3.3 (#487)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.24.0 (#488)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.24.1 (#490)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.6.0 (#491)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.9.10 (#494)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.24.2 (#495)
|
||||
- *(deps)* Update ktor to v2.3.4 (#496)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-datetime to v0.4.1 (#497)
|
||||
- *(deps)* Update kotestversion to v5.7.0 (#498)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.9 (#500)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.9 (#499)
|
||||
- *(deps)* Update kotestversion to v5.7.1 (#501)
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Docs
|
||||
|
||||
### Added
|
||||
### Major
|
||||
|
||||
- Added ability to inject an emergency `UndeclaredField` in the event of certain polymorphic serializers and such
|
||||
- V4 alpha (#505)
|
||||
|
||||
## [1.6.0] - August 12th, 2021
|
||||
## [3.14.4] - 2023-06-05
|
||||
|
||||
### Added
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Ability to add custom type schema overrides for edge case types.
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.23.2 (#472)
|
||||
- *(deps)* Update ktor to v2.3.1 (#473)
|
||||
- *(deps)* Update dependency io.ktor:ktor-server-core to v2.3.1 (#474)
|
||||
- References for for protobuf objects (#466)
|
||||
|
||||
## [1.5.1] - August 12th, 2021
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
### Changed
|
||||
- Prep for 3.14.4 release
|
||||
|
||||
- Fixed bug where polymorphic types were not being rendered correctly when part of collections and maps
|
||||
## [3.14.3] - 2023-05-22
|
||||
|
||||
## [1.5.0] - July 25th, 2021
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Changed
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.8.21 (#460)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.23.0 (#461)
|
||||
- *(deps)* Update kotestversion to v5.6.2 (#462)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.5.1 (#463)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.23.1 (#469)
|
||||
- Allow for request bodies to be marked as required=false (#470)
|
||||
|
||||
- Added support for BigInteger and BigDecimal in response types
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
## [1.4.0] - July 22nd, 2021
|
||||
- Prep for 3.14.3 release
|
||||
|
||||
### Changed
|
||||
## [3.14.2] - 2023-05-08
|
||||
|
||||
- Decreased jvmTarget version from 11 to 1.8
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
## [1.3.0] - June 4th, 2021
|
||||
- Route with parameter declared via ktor function (#455)
|
||||
|
||||
### Changed
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Explicitly encode JSON object by default
|
||||
- Prep for 3.14.2 release
|
||||
|
||||
## [1.2.3] - June 3rd, 2021
|
||||
## [3.14.1] - 2023-04-28
|
||||
|
||||
### Added
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Updates showing/explaining serializer agnostic approach
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.22.3 (#448)
|
||||
- *(deps)* Update dependency io.kotest:kotest-runner-junit5-jvm to v5.6.0 (#450)
|
||||
- *(deps)* Update dependency io.kotest:kotest-assertions-json-jvm to v5.6.1 (#451)
|
||||
- *(deps)* Update ktor to v2.3.0 (#452)
|
||||
- Fixed generic property enrichment (#454)
|
||||
|
||||
## [1.2.2] - May 23rd, 2021
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
This is just to get my repo back to normal now that I have confirmed sonatype publish is happening
|
||||
- Rearrange docs (#447)
|
||||
- Prep for 3.14.1 release
|
||||
|
||||
## [1.2.0] - May 23rd, 2021
|
||||
## [3.14.0] - 2023-04-06
|
||||
|
||||
### Added
|
||||
### 🚀 Features
|
||||
|
||||
- Finally, successfully pushed to Maven Central!!!
|
||||
- Introduce Support for Response Headers (#446)
|
||||
|
||||
## [1.1.0] - May 19th, 2021
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Added
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.22.2 (#429)
|
||||
- *(deps)* Update ktor to v2.2.4 (#430)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.5.0 (#432)
|
||||
- *(deps)* Update dependency io.gitlab.arturbosch.detekt:detekt-formatting to v1.22.0 (#388)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.7 (#433)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.7 (#434)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.3 (#435)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.4 (#436)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.8.20 (#438)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.5 (#441)
|
||||
- *(deps)* Update dependency dev.forst:ktor-api-key to v2.2.4 (#442)
|
||||
|
||||
- Support for sealed classes 🔥
|
||||
- Support for generic classes ☄️
|
||||
### 📚 Documentation
|
||||
|
||||
## [1.0.1] - May 10th, 2021
|
||||
- Add showcase link to readme
|
||||
|
||||
### Changed
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- a word to sweep my rude commit message to Nexus under the rug
|
||||
- Prep for 3.14.0 release
|
||||
|
||||
## [1.0.0] - May 9th, 2021
|
||||
## [3.13.0] - 2023-03-15
|
||||
|
||||
### Added
|
||||
### 🚀 Features
|
||||
|
||||
- SonaType integration to publish to MavenCentral
|
||||
- Support no request body for post, put and patch (#427)
|
||||
|
||||
### [1.0.0-rc] - May 8th, 2021
|
||||
## [3.12.0] - 2023-03-14
|
||||
|
||||
### Changed
|
||||
### 🚀 Features
|
||||
|
||||
- Migrated to io.bkbn group and package name
|
||||
- Reintroduce swagger compatability (#426)
|
||||
|
||||
### [1.0.0-beta] - May 6th, 2021
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Added
|
||||
- *(deps)* Update ktor to v2.2.3 (#414)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.8.10 (#418)
|
||||
- *(deps)* Update kotestversion to v5.5.5 (#420)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.22.0 (#421)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api to v2.20.0 (#422)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-core to v2.20.0 (#423)
|
||||
|
||||
- Release action to package a release JAR 🍻
|
||||
- EXTREME DOCUMENTATION 📜
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
### Changed
|
||||
- Prep for 3.12.0 release
|
||||
|
||||
- Cleanup to test files
|
||||
- Removes KompendiumHttpCodes in favor of Ktor HttpStatusCode
|
||||
## [3.11.1] - 2023-01-31
|
||||
|
||||
### [0.9.0] - May 5th, 2021
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Added
|
||||
- *(deps)* Update dependency dev.forst:ktor-api-key to v2.2.2 (#410)
|
||||
- Drop logback (#413)
|
||||
|
||||
- Support for default parameter responses
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
### Changed
|
||||
- Fix incorrect line in documentation
|
||||
|
||||
- In order to facilitate default parameters, a couple changes were needed
|
||||
- `KompendiumParam` was added in replacement of the four parameter annotations
|
||||
- Specs now explicitly declare type of parameter rather than a reference in order to not override default values.
|
||||
## [3.11.0] - 2023-01-05
|
||||
|
||||
## [0.8.0] - May 4th, 2021
|
||||
### 🚀 Features
|
||||
|
||||
### Added
|
||||
- Constraints (#409)
|
||||
|
||||
- Support for example request and response bodies. Parameter examples / defaults are a separate issue for later.
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Changed
|
||||
- *(deps)* Update ktor (#397)
|
||||
|
||||
- Converted `MethodInfo` into a sealed class with distinct method types for Get, Post, Put, and Delete
|
||||
## [3.10.0] - 2023-01-05
|
||||
|
||||
## [0.7.0] - April 29th, 2021
|
||||
### 🚀 Features
|
||||
|
||||
### Added
|
||||
- Type enrichment (#408)
|
||||
|
||||
- `notarizedException` for notarizing `StatusPage` handlers 🎉
|
||||
- `com.adarshr.test-logger` Gradle plugin for improved test output clarity and insight
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Changed
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.4 (#385)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.4 (#386)
|
||||
- *(deps)* Update dependency ch.qos.logback:logback-classic to v1.4.5 (#387)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.5 (#389)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.5 (#390)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.7.22 (#394)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.21.10 (#395)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.2 (#396)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.21.11 (#398)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.6 (#400)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.6 (#401)
|
||||
- *(deps)* Update dependency com.google.protobuf:protobuf-java to v3.21.12 (#402)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlin:kotlin-reflect to v1.8.0 (#405)
|
||||
|
||||
- Refactored `kompendium-core` to break up the `Kompendium` object into slightly more manageable chunks
|
||||
- Notarization Parameters can now be inferred from method info
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
## [0.6.2] - April 23rd, 2021
|
||||
- Bump gradle version
|
||||
|
||||
### Added
|
||||
## [3.9.0] - 2022-11-16
|
||||
|
||||
- Request params are not required when property is nullable
|
||||
### 🚀 Features
|
||||
|
||||
## [0.6.1] - April 23rd, 2021
|
||||
- Protobuf java converters (#382)
|
||||
|
||||
### Added
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Added support for Swagger ui
|
||||
- Do not include rootPath in serialized route path
|
||||
|
||||
### Changed
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Set jvm target to 11
|
||||
- Resolved bug for empty params and/or empty response body
|
||||
- Prep for 3.9.0 release
|
||||
|
||||
## [0.6.0] - April 21st, 2021
|
||||
## [3.8.0] - 2022-11-09
|
||||
|
||||
### Added
|
||||
### 🚀 Features
|
||||
|
||||
- Added basic and jwt security scheme support with the new module kompendium-auth
|
||||
- Support partial authentication (#372) (#375)
|
||||
- NotarizedResource plugin
|
||||
|
||||
## [0.5.2] - April 19th, 2021
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Removed
|
||||
- *(deps)* Update kotlin monorepo to v1.7.21 (#374)
|
||||
|
||||
- Removed `Route.calculatePath`
|
||||
|
||||
### Added
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Added an explicit `PathCalculator` interface to allow for easier handling of routes external to the core set of Ktor route selectors.
|
||||
- Delete autoupdate action
|
||||
- Prep for 3.8.0 release
|
||||
|
||||
## [0.5.1] - April 19th, 2021
|
||||
## [3.7.0] - 2022-11-05
|
||||
|
||||
### Changed
|
||||
### 🚀 Features
|
||||
|
||||
- Resolved bug where paths under root route where appending a trailing `/`
|
||||
- Allow media type overrides (#369)
|
||||
|
||||
## [0.5.0] - April 19th, 2021
|
||||
## [3.6.0] - 2022-11-05
|
||||
|
||||
### Added
|
||||
### 🚀 Features
|
||||
|
||||
- Expose `/openapi.json` and `/docs` as opt-in pre-built Routes
|
||||
- Create schema reference for enum types (#368)
|
||||
|
||||
## [0.4.0] - April 17th, 2021
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Added
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.1 (#359)
|
||||
- *(deps)* Update ktor to v2.1.3 (#360)
|
||||
- *(deps)* Update dependency dev.forst:ktor-api-key to v2.1.3 (#361)
|
||||
- *(deps)* Update kotestversion to v5.5.4 (#363)
|
||||
|
||||
- Basic Query and Path Parameter Support 🍻
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
### Changed
|
||||
- Prep for release
|
||||
|
||||
- No content workaround, flow will likely need refactoring for clarity.
|
||||
## [3.5.0] - 2022-10-29
|
||||
|
||||
## [0.3.0] - April 17th, 2021
|
||||
### 🚀 Features
|
||||
|
||||
### Changed
|
||||
- Add plugin to support ktor-server-resources (#358)
|
||||
|
||||
- Removed response and request annotations in favor of MethodInfo extension.
|
||||
- Modified notarization to add the correct reference slug regardless of type
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
## [0.2.0] - April 16th, 2021
|
||||
- *(deps)* Update kotestversion to v5.5.3 (#355)
|
||||
- *(deps)* Update dependency io.ktor:ktor-server-content-negotiation to v2.1.3 (#357)
|
||||
|
||||
### Changed
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Another re-haul to the reflection analysis
|
||||
- Top level generics, enums, collections, and maps now supported 🙌
|
||||
- Prep for 3.5.0 release
|
||||
|
||||
## [0.1.1] - April 16th, 2021
|
||||
## [3.4.0] - 2022-10-26
|
||||
|
||||
### Added
|
||||
### 🚀 Features
|
||||
|
||||
- Explicit UUID support to prevent incorrect interpretation as complex object
|
||||
- Add possibility to customize docs path (#352)
|
||||
|
||||
## [0.1.0] - April 16th, 2021
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
### Changed
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.3 (#328)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.3 (#329)
|
||||
- *(deps)* Update ktor to v2.1.2 (#340)
|
||||
- *(deps)* Update kotestversion to v5.5.0 (#343)
|
||||
- *(deps)* Update dependency ch.qos.logback:logback-classic to v1.4.3 (#342)
|
||||
- *(deps)* Update dependency io.kotest:kotest-property-jvm to v5.5.1 (#347)
|
||||
- *(deps)* Update dependency ch.qos.logback:logback-classic to v1.4.4 (#348)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.12.0 (#349)
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.4.1 (#350)
|
||||
- *(deps)* Update dependency io.kotest:kotest-runner-junit5-jvm to v5.5.2 (#351)
|
||||
|
||||
- Completely redid the reflection system to improve flow, decrease errors ✨
|
||||
### 📚 Documentation
|
||||
|
||||
### Added
|
||||
- Added Latest Documentation ✨
|
||||
- Initial gitbook docs (#336)
|
||||
|
||||
- Added ReDoc to the Playground to make manual testing more convenient
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
## [0.0.7] - April 16th, 2021
|
||||
- Migrate to gitbook (#334)
|
||||
- Bumped versions (#341)
|
||||
- Update to sourdough 0.12.0
|
||||
- Show nested documentation on basic playground
|
||||
- Prep for 3.4.0 release
|
||||
|
||||
### Added
|
||||
## [3.3.1] - 2022-09-26
|
||||
|
||||
- Include sources in publish 📚
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
## [0.0.6] - April 15th, 2021
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.1 (#317)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api to v2.19.0 (#320)
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-core to v2.19.0 (#321)
|
||||
- *(deps)* Update dependency dev.forst:ktor-api-key to v2.1.1-1 (#322)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-api to v2.0.2 (#323)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.2 (#324)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.11.2 (#326)
|
||||
- Improved error output when an unknown schema is encountered (#327)
|
||||
|
||||
### Added
|
||||
### 📚 Documentation
|
||||
|
||||
- Logging to get a more intuitive sense for operations performed
|
||||
- Serialization for Maps, Collections and Enums
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
## [0.0.5] - April 15th, 2021
|
||||
## [3.3.0] - 2022-09-15
|
||||
|
||||
### Added
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Full list of compile-time-constant status codes
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.11.1 (#307)
|
||||
- *(deps)* Update dependency ch.qos.logback:logback-classic to v1.4.0 (#311)
|
||||
- *(deps)* Update ktor to v2.1.1 (#312)
|
||||
- *(deps)* Update dependency dev.forst:ktor-api-key to v2.1.1 (#313)
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2.0.1 (#314)
|
||||
- *(deps)* Update dependency ch.qos.logback:logback-classic to v1.4.1 (#316)
|
||||
- Remove print statements for examples (#318)
|
||||
|
||||
## [0.0.4] - April 14th, 2021
|
||||
### 📚 Documentation
|
||||
|
||||
### Changed
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
- Added fix to route selector matching that accounts for trailing slash selection
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
## [0.0.3] - April 13th, 2021
|
||||
- Bump kover version (#308)
|
||||
- Enable recursion test (#315)
|
||||
- Prep for 3.3.0 (#319)
|
||||
|
||||
### Added
|
||||
## [3.2.0] - 2022-08-23
|
||||
|
||||
- Notarized Deletes
|
||||
- Request and Response reflection abstractions
|
||||
- Basic unit test coverage for each notarized operation
|
||||
### 🚀 Features
|
||||
|
||||
## [0.0.2] - April 12th, 2021
|
||||
- Schema configurator to enable field name overrides and transient field omission (#302)
|
||||
|
||||
### Added
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Beginning of an implementation. Currently, able to generate a rough outline of the API at runtime, along with generating
|
||||
full data classes represented by JSON Schema.
|
||||
- *(deps)* Update dependency org.slf4j:slf4j-simple to v2 (#301)
|
||||
|
||||
## [0.0.1] - April 11th, 2021
|
||||
### 📚 Documentation
|
||||
|
||||
### Added
|
||||
- Added _most_ of the data classes necessary for generating an [Open API Spec](https://swagger.io/specification)
|
||||
- Added playground to allow users to tinker with a live Ktor api in conjunction with development
|
||||
- Added all standard OSS files
|
||||
- Absolutely paltry README
|
||||
- Added License
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Prep 3.2.0 release
|
||||
|
||||
## [3.1.0] - 2022-08-19
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Auto auth detect (#299)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Incorrectly nested example
|
||||
- *(deps)* Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.4.0 (#298)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
- Add compatibility matrix on README
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Clean up some bad habits
|
||||
- Move playground from netty to cio
|
||||
|
||||
## [3.0.0] - 2022-08-16
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- V3 locations (#292)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update dependency org.apache.logging.log4j:log4j-api to v2.18.0 (#283)
|
||||
- Spec and docs behind auth (#284)
|
||||
- Type erasure breaking nested generics (#285)
|
||||
- Null ref (#286)
|
||||
- Recursion (#293)
|
||||
- Complex generic breaks introspection (#294)
|
||||
- Uuid schema (#296)
|
||||
- Nested class name support
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Some dokka updates (#295)
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Prep for 3.0 release
|
||||
|
||||
## [3.0.0-alpha] - 2022-08-13
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update kotestversion to v5.4.1 (#278)
|
||||
- *(deps)* Update dependency org.webjars:swagger-ui to v4.13.2 (#279)
|
||||
- *(deps)* Update kotestversion to v5.4.2 (#281)
|
||||
- *(deps)* Update dependency joda-time:joda-time to v2.11.0 (#282)
|
||||
|
||||
## [2.3.5] - 2022-06-07
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Serialization of api key auth location (#261)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Prep for 2.3.5 release
|
||||
|
||||
## [2.3.4] - 2022-04-07
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Put info request body nullable
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
## [2.3.3] - 2022-04-01
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Swagger ui regression from dependency bump
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Prep for 2.3.3 release
|
||||
|
||||
## [2.3.2] - 2022-03-30
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Nullable enum support (#234)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
## [2.3.1] - 2022-03-05
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Free form annotation can be applied to top level type (#219)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
## [2.3.0] - 2022-03-01
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Added SwaggerUI KTor Plugin (#215)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Prep for 2.3.0 release
|
||||
|
||||
## [2.2.1] - 2022-02-26
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Support Maps with sealed class type (#211)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Prep for 2.2.1 release
|
||||
|
||||
## [2.2.0] - 2022-02-25
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Enable format support on type definitions
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- (#194) to support Location classes located in other non-location classes (e.g. inside Object) (#207)
|
||||
- Formatting custom SimpleSchema (fixes #198) (#208)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Prep for 2.2.0 release
|
||||
|
||||
## [2.1.1] - 2022-02-19
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Nullability breaks object comparison (#202)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
### Fix
|
||||
|
||||
- Unable to use sealed typed collections #199 (#200)
|
||||
|
||||
## [2.1.0] - 2022-02-18
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Allow for overriding openapi endpoint (#192)
|
||||
- Moving request and response to references (#181)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
## [2.0.4] - 2022-02-10
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Bumped swagger version + minor playground fix (#191)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
- Add custom type example to playground (#189)
|
||||
- Add contributing and code of conduct guides (#190)
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Handler refactor (#179)
|
||||
- Test all serializers (#180)
|
||||
|
||||
## [2.0.3] - 2022-02-07
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Swagger ui bug (#177)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
## [2.0.2] - 2022-02-04
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Support recursive types (#174)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Added Latest Documentation ✨
|
||||
|
||||
## [2.0.1] - 2022-01-23
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Bug in doc publishing pipeline
|
||||
|
||||
## [2.0.0] - 2022-01-23
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Kompendium 2.0.0 release!
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Version bumps and cleanup (#156)
|
||||
|
||||
## [2.0.0-beta-hotfix] - 2022-01-12
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Adding signing plugin (#147)
|
||||
|
||||
## [2.0.0-beta] - 2022-01-12
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Added head, patch, and options methods (#132)
|
||||
- Enable creation of explicit parameter examples (#133)
|
||||
- Multi Serialization Support (#134)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Locations inheritance (#135)
|
||||
- Bug in testing suite + lots of documentation updates
|
||||
|
||||
## [2.0.0-alpha-hotfix] - 2022-01-03
|
||||
|
||||
### Hotfix
|
||||
|
||||
- Hopefully fix bug in release pipeline
|
||||
|
||||
## [2.0.0-alpha] - 2022-01-03
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- V2-alpha (#112)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Example header parameter (#114)
|
||||
|
||||
## [1.11.0] - 2021-11-25
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Add opt-in locations support via ancillary module (#107)
|
||||
|
||||
## [1.10.0] - 2021-11-25
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Add operationId method info (#106)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Allow for injectable ObjectMapper to resolve serialization issues for Java 8 date type
|
||||
|
||||
## [1.9.1] - 2021-10-17
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Code coverage pr check removed
|
||||
|
||||
<!-- generated by git-cliff -->
|
||||
|
80
CODE_OF_CONDUCT.md
Normal file
80
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,80 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
||||
* Contacting individual members, contributors, or leaders privately, outside designated community mechanisms, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at opensource@github.com. All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at <https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
|
73
CONTRIBUTING.md
Normal file
73
CONTRIBUTING.md
Normal file
@ -0,0 +1,73 @@
|
||||
# Welcome to Kompendium contributing guide <!-- omit in toc -->
|
||||
|
||||
Thank you for investing your time in contributing to our project! Any contribution you make will help build the best OpenAPI generator for Ktor :sparkles:.
|
||||
|
||||
Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
|
||||
|
||||
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
|
||||
|
||||
Use the table of contents icon in the top left corner of this document to get to a specific section of this guide quickly.
|
||||
|
||||
## New contributor guide
|
||||
|
||||
To get an overview of the project, read the [README](README.md). Here are some resources to help you get started with open source contributions:
|
||||
|
||||
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
|
||||
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
|
||||
- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
|
||||
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
The best way to get started with Kompendium is to read the [docs](https://bkbn.gitbook.io/kompendium).
|
||||
|
||||
If live examples are more your thing, inside the `kompendium-playground` module, you will find a collection of starter
|
||||
examples ranging from simple CRUD and authentication examples, to more advanced topics like polymorphic serialization
|
||||
and custom type overrides.
|
||||
|
||||
### Issues
|
||||
|
||||
#### Create a new issue
|
||||
|
||||
If you've discovered an issue with Kompendium, or have an idea for a new feature, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/bkbnio/kompendium/issues/new/choose).
|
||||
|
||||
#### Solve an issue
|
||||
|
||||
Scan through our [existing issues](https://github.com/bkbnio/kompendium/issues) to find one that interests you. As a general rule, issue assignment is informal and not required. If you find an issue to work on, you are welcome to open a PR with a fix.
|
||||
|
||||
### Make Changes
|
||||
|
||||
#### Make changes locally
|
||||
|
||||
1. Fork the repository.
|
||||
- Using GitHub Desktop:
|
||||
- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
|
||||
- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!
|
||||
|
||||
- Using the command line:
|
||||
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.
|
||||
|
||||
- GitHub Codespaces:
|
||||
- [Fork, edit, and preview](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace) using [GitHub Codespaces](https://github.com/features/codespaces) without having to install and run the project locally.
|
||||
|
||||
2. Install Java. Any version of Java 11+ should be fine.
|
||||
|
||||
3. Create a working branch and start with your changes!
|
||||
|
||||
### Commit your update
|
||||
|
||||
Commit the changes once you are happy with them. Git hooks are automatically installed via Gradle that will run the linter
|
||||
on every commit, and run the tests prior to pushing your code. This helps speed up the review cycle immensely. If you would like
|
||||
to push a draft PR that skips the hooks, you can simply add the `--no-verify` flag, ie `git commit --no-verify -m "commit message"`.
|
||||
|
||||
### Pull Request
|
||||
|
||||
When you're finished with the changes, you are ready to create a pull request! There is no hard and fast rules here, but
|
||||
do your best to fill out the pull request template with all the requisite information!
|
||||
|
||||
### Your PR is merged!
|
||||
|
||||
Congratulations :tada::tada: The Kompendium team thanks you :sparkles:.
|
||||
|
||||
Once your PR is merged, it will go out in the next release cycle. We often keep these cycles super tight, it is not uncommon for each PR to get its own release.
|
267
README.md
267
README.md
@ -2,269 +2,8 @@
|
||||
|
||||
[](https://search.maven.org/search?q=io.bkbn%20kompendium)
|
||||
|
||||
## What is Kompendium
|
||||
Documentation is stored in the `docs` folder and is hosted [here](https://bkbn.gitbook.io/kompendium)
|
||||
|
||||
Kompendium is intended to be a minimally invasive OpenApi Specification generator for [Ktor](https://ktor.io).
|
||||
Minimally invasive meaning that users will use only Ktor native functions when implementing their API, and will
|
||||
supplement with Kompendium code in order to generate the appropriate spec.
|
||||
## Showcase
|
||||
|
||||
## How to install
|
||||
|
||||
Kompendium publishes all releases to Maven Central. As such, using the stable version of `Kompendium` is as simple
|
||||
as declaring it as an implementation dependency in your `build.gradle.kts`
|
||||
|
||||
```kotlin
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// other (less cool) dependencies
|
||||
implementation("io.bkbn:kompendium-core:latest")
|
||||
implementation("io.bkbn:kompendium-auth:latest")
|
||||
implementation("io.bkbn:kompendium-swagger-ui:latest")
|
||||
}
|
||||
```
|
||||
|
||||
The last two dependencies are optional.
|
||||
|
||||
If you want to get a little spicy 🤠 every merge of Kompendium is published to the GitHub package registry. Pulling
|
||||
from GitHub is slightly more involved, but such is the price you pay for bleeding edge fake data generation.
|
||||
|
||||
```kotlin
|
||||
// 1 Setup a helper function to import any Github Repository Package
|
||||
// This step is optional but I have a bunch of stuff stored on github so I find it useful 😄
|
||||
fun RepositoryHandler.github(packageUrl: String) = maven {
|
||||
name = "GithubPackages"
|
||||
url = uri(packageUrl)
|
||||
credentials {
|
||||
username = java.lang.System.getenv("GITHUB_USER")
|
||||
password = java.lang.System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
|
||||
// 2 Add the repo in question (in this case Kompendium)
|
||||
repositories {
|
||||
github("https://maven.pkg.github.com/bkbnio/kompendium")
|
||||
}
|
||||
|
||||
// 3 Add the package like any normal dependency
|
||||
dependencies {
|
||||
implementation("io.bkbn:kompendium-core:1.0.0")
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## In depth
|
||||
|
||||
### Notarized Routes
|
||||
|
||||
Kompendium introduces the concept of `notarized` HTTP methods. That is, for all your `GET`, `POST`, `PUT`, and `DELETE`
|
||||
operations, there is a corresponding `notarized` method. These operations are strongly typed, and use reification for
|
||||
a lot of the class based reflection that powers Kompendium. Generally speaking the three types that a `notarized` method
|
||||
will consume are
|
||||
|
||||
- `TParam`: Used to notarize expected request parameters
|
||||
- `TReq`: Used to build the object schema for a request body
|
||||
- `TResp`: Used to build the object schema for a response body
|
||||
|
||||
`GET` and `DELETE` take `TParam` and `TResp` while `PUT` and `POST` take all three.
|
||||
|
||||
|
||||
In addition to standard HTTP Methods, Kompendium also introduced the concept of `notarizedExceptions`. Using the `StatusPage`
|
||||
extension, users can notarize all handled exceptions, along with their respective HTTP codes and response types.
|
||||
Exceptions that have been `notarized` require two types as supplemental information
|
||||
|
||||
- `TErr`: Used to notarize the exception being handled by this use case. Used for matching responses at the route level.
|
||||
- `TResp`: Same as above, this dictates the expected return type of the error response.
|
||||
|
||||
In keeping with minimal invasion, these extension methods all consume the same code block as a standard Ktor route method,
|
||||
meaning that swapping in a default Ktor route and a Kompendium `notarized` route is as simple as a single method change.
|
||||
|
||||
### Supplemental Annotations
|
||||
|
||||
In general, Kompendium tries to limit the number of annotations that developers need to use in order to get an app
|
||||
integrated.
|
||||
|
||||
Currently, the annotations used by Kompendium are as follows
|
||||
|
||||
- `KompendiumField`
|
||||
- `KompendiumParam`
|
||||
|
||||
The intended purpose of `KompendiumField` is to offer field level overrides such as naming conventions (ie snake instead of camel).
|
||||
|
||||
The purpose of `KompendiumParam` is to provide supplemental information needed to properly assign the type of parameter
|
||||
(cookie, header, query, path) as well as other parameter-level metadata.
|
||||
|
||||
### Undeclared Field
|
||||
|
||||
There is also a final `UndeclaredField` annotation. This should be used only in an absolutely emergency. This annotation
|
||||
will allow you to inject a _single_ undeclared field that will be included as part of the schema.
|
||||
|
||||
Due to limitations in using repeated annotations, this can only be used once per class
|
||||
|
||||
This is a complete hack, and is included for odd scenarios like kotlinx serialization polymorphic adapters that expect a
|
||||
`type` field in order to perform their analysis.
|
||||
|
||||
Use this _only_ when **all** else fails
|
||||
|
||||
### Polymorphism
|
||||
|
||||
Speaking of polymorphism... out of the box, Kompendium has support for sealed classes and interfaces. At runtime, it will build a mapping of all available sub-classes
|
||||
and build a spec that takes `anyOf` the implementations. This is currently a weak point of the entire library, and
|
||||
suggestions on better implementations are welcome 🤠
|
||||
|
||||
### Serialization
|
||||
|
||||
Under the hood, Kompendium uses Jackson to serialize the final api spec. However, this implementation detail
|
||||
does not leak to the actual API, meaning that users are free to choose the serialization library of their choice.
|
||||
|
||||
## Examples
|
||||
|
||||
The full source code can be found in the `kompendium-playground` module. Here is a simple get endpoint example
|
||||
|
||||
```kotlin
|
||||
// Minimal API Example
|
||||
fun Application.mainModule() {
|
||||
install(StatusPages) {
|
||||
notarizedException<Exception, ExceptionResponse>(
|
||||
info = ResponseInfo(
|
||||
KompendiumHttpCodes.BAD_REQUEST,
|
||||
"Bad Things Happened"
|
||||
)
|
||||
) {
|
||||
call.respond(HttpStatusCode.BadRequest, ExceptionResponse("Why you do dis?"))
|
||||
}
|
||||
}
|
||||
routing {
|
||||
openApi(oas)
|
||||
redoc(oas)
|
||||
swaggerUI()
|
||||
route("/potato/spud") {
|
||||
notarizedGet(simpleGetInfo) {
|
||||
call.respond(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val simpleGetInfo = GetInfo<Unit, ExampleResponse>(
|
||||
summary = "Example Parameters",
|
||||
description = "A test for setting parameter examples",
|
||||
responseInfo = ResponseInfo(
|
||||
status = 200,
|
||||
description = "nice",
|
||||
examples = mapOf("test" to ExampleResponse(c = "spud"))
|
||||
),
|
||||
canThrow = setOf(Exception::class)
|
||||
)
|
||||
```
|
||||
|
||||
### Kompendium Auth and security schemes
|
||||
|
||||
There is a separate library to handle security schemes: `kompendium-auth`.
|
||||
This needs to be added to your project as dependency.
|
||||
|
||||
At the moment, the basic and jwt authentication is only supported.
|
||||
|
||||
A minimal example would be:
|
||||
```kotlin
|
||||
install(Authentication) {
|
||||
notarizedBasic("basic") {
|
||||
realm = "Ktor realm 1"
|
||||
// configure basic authentication provider..
|
||||
}
|
||||
notarizedJwt("jwt") {
|
||||
realm = "Ktor realm 2"
|
||||
// configure jwt authentication provider...
|
||||
}
|
||||
}
|
||||
routing {
|
||||
authenticate("basic") {
|
||||
route("/basic_auth") {
|
||||
notarizedGet(basicAuthGetInfo) {
|
||||
call.respondText { "basic auth" }
|
||||
}
|
||||
}
|
||||
}
|
||||
authenticate("jwt") {
|
||||
route("/jwt") {
|
||||
notarizedGet(jwtAuthGetInfo) {
|
||||
call.respondText { "jwt" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val basicAuthGetInfo = MethodInfo<Unit, ExampleResponse>(
|
||||
summary = "Another get test",
|
||||
description = "testing more",
|
||||
responseInfo = testGetResponse,
|
||||
securitySchemes = setOf("basic")
|
||||
)
|
||||
val jwtAuthGetInfo = basicAuthGetInfo.copy(securitySchemes = setOf("jwt"))
|
||||
```
|
||||
|
||||
### Enabling Swagger ui
|
||||
To enable Swagger UI, `kompendium-swagger-ui` needs to be added.
|
||||
This will also add the [ktor webjars feature](https://ktor.io/docs/webjars.html) to your classpath as it is required for swagger ui.
|
||||
Minimal Example:
|
||||
```kotlin
|
||||
install(Webjars)
|
||||
routing {
|
||||
openApi(oas)
|
||||
swaggerUI()
|
||||
}
|
||||
```
|
||||
|
||||
### Enabling ReDoc
|
||||
Unlike swagger, redoc is provided (perhaps confusingly, in the `core` module). This means out of the box with `kompendium-core`, you can add
|
||||
[ReDoc](https://github.com/Redocly/redoc) as follows
|
||||
|
||||
```kotlin
|
||||
routing {
|
||||
openApi(oas)
|
||||
redoc(oas)
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Type Overrides
|
||||
|
||||
Kompendium does its best to analyze types and to generate an OpenAPI format accordingly. However, there are certain
|
||||
classes that just don't play nice with the standard reflection analysis that Kompendium performs.
|
||||
Should you encounter a data type that Kompendium cannot comprehend, you will need to
|
||||
add it explicitly. For example, adding the Joda Time `DateTime` object would be as simple as the following
|
||||
|
||||
```kotlin
|
||||
Kompendium.addCustomTypeSchema(DateTime::class, FormatSchema("date-time", "string"))
|
||||
```
|
||||
|
||||
Since `Kompendium` is an object, this needs to be declared once, ahead of the actual API instantiation. This way, this
|
||||
type override can be cached ahead of reflection. Kompendium will then match all instances of this type and return the
|
||||
specified schema.
|
||||
|
||||
So how do you know a type can and cannot be inferred? The safe bet is that it can be. So go ahead and give it a shot.
|
||||
However, in the very odd scenario (almost always having to do with date/time libraries 😤) where it can't, you can rest
|
||||
safely knowing that you have the option to inject a custom override should you need to.
|
||||
|
||||
## Limitations
|
||||
|
||||
### Kompendium as a singleton
|
||||
|
||||
Currently, Kompendium exists as a Kotlin object. This comes with a couple perks, but a couple downsides. Primarily,
|
||||
it offers a seriously clean UX where the implementer doesn't need to worry about what instance to send data to. The main
|
||||
drawback, however, is that you are limited to a single API per classpath.
|
||||
|
||||
If this is a blocker, please open a GitHub issue, and we can start to think out solutions!
|
||||
|
||||
## Future Work
|
||||
Work on V1 of Kompendium has come to a close. This, however, does not mean it has achieved complete
|
||||
parity with the OpenAPI feature spec, nor does it have all-of-the nice to have features that a truly next-gen API spec
|
||||
should have. There are several outstanding features that have been added to the
|
||||
[V2 Milestone](https://github.com/bkbnio/kompendium/milestone/2). Among others, this includes
|
||||
|
||||
- AsyncAPI Integration
|
||||
- Field Validation
|
||||
|
||||
If you have a feature that you would like to see implemented that is not on this list, or discover a 🐞, please open
|
||||
an issue [here](https://github.com/bkbnio/kompendium/issues/new)
|
||||
If you would like to showcase docs that you build using Kompendium, add them to [the showcase discussion](https://github.com/bkbnio/kompendium/discussions/444)
|
||||
|
@ -1,13 +1,19 @@
|
||||
import com.adarshr.gradle.testlogger.TestLoggerExtension
|
||||
import com.adarshr.gradle.testlogger.theme.ThemeType
|
||||
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import com.vanniktech.maven.publish.SonatypeHost
|
||||
import io.bkbn.sourdough.gradle.library.jvm.LibraryJvmPlugin
|
||||
import io.bkbn.sourdough.gradle.library.jvm.LibraryJvmExtension
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm") version "1.5.0" apply false
|
||||
id("io.gitlab.arturbosch.detekt") version "1.17.0-RC3" apply false
|
||||
id("com.adarshr.test-logger") version "3.0.0" apply false
|
||||
id("io.github.gradle-nexus.publish-plugin") version "1.1.0" apply true
|
||||
kotlin("jvm") version "2.1.20" apply false
|
||||
kotlin("plugin.serialization") version "2.1.20" apply false
|
||||
id("io.bkbn.sourdough.library.jvm") version "0.13.1" apply false
|
||||
id("io.bkbn.sourdough.application.jvm") version "0.13.1" apply false
|
||||
id("com.vanniktech.maven.publish") version "0.31.0" apply false
|
||||
id("io.bkbn.sourdough.root") version "0.13.1"
|
||||
id("org.jetbrains.kotlinx.kover") version "0.9.1"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
subprojects.forEach { kover(it) }
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@ -20,59 +26,19 @@ allprojects {
|
||||
else -> "$baseVersion-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") }
|
||||
}
|
||||
|
||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
||||
apply(plugin = "io.gitlab.arturbosch.detekt")
|
||||
apply(plugin = "com.adarshr.test-logger")
|
||||
apply(plugin = "idea")
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
configure<TestLoggerExtension> {
|
||||
theme = ThemeType.MOCHA
|
||||
setLogLevel("lifecycle")
|
||||
showExceptions = true
|
||||
showStackTraces = true
|
||||
showFullStackTraces = false
|
||||
showCauses = true
|
||||
slowThreshold = 2000
|
||||
showSummary = true
|
||||
showSimpleNames = false
|
||||
showPassed = true
|
||||
showSkipped = true
|
||||
showFailed = true
|
||||
showStandardStreams = false
|
||||
showPassedStandardStreams = true
|
||||
showSkippedStandardStreams = true
|
||||
showFailedStandardStreams = true
|
||||
}
|
||||
|
||||
configure<DetektExtension> {
|
||||
toolVersion = "1.17.0-RC3"
|
||||
config = files("${rootProject.projectDir}/detekt.yml")
|
||||
buildUponDefaultConfig = true
|
||||
}
|
||||
|
||||
configure<JavaPluginExtension> {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
|
||||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
||||
subprojects {
|
||||
plugins.withType(LibraryJvmPlugin::class) {
|
||||
extensions.configure(LibraryJvmExtension::class) {
|
||||
githubOrg.set("bkbnio")
|
||||
githubRepo.set("kompendium")
|
||||
licenseName.set("MIT License")
|
||||
licenseUrl.set("https://mit-license.org")
|
||||
developerId.set("brizzbuzz")
|
||||
developerName.set("Ryan Brink")
|
||||
developerEmail.set("admin@bkbn.io")
|
||||
sonatypeHost.set(SonatypeHost.CENTRAL_PORTAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
codacy.yml
Normal file
3
codacy.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
exclude_paths:
|
||||
- "**/*.md"
|
70
core/build.gradle.kts
Normal file
70
core/build.gradle.kts
Normal file
@ -0,0 +1,70 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
kotlin("plugin.serialization")
|
||||
id("io.bkbn.sourdough.library.jvm")
|
||||
id("io.gitlab.arturbosch.detekt")
|
||||
id("com.adarshr.test-logger")
|
||||
id("com.vanniktech.maven.publish")
|
||||
id("java-library")
|
||||
id("signing")
|
||||
id("java-test-fixtures")
|
||||
id("org.jetbrains.kotlinx.kover")
|
||||
}
|
||||
|
||||
sourdoughLibrary {
|
||||
libraryName.set("Kompendium Core")
|
||||
libraryDescription.set("Core functionality for the Kompendium library")
|
||||
compilerArgs.set(listOf("-opt-in=kotlin.RequiresOptIn"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// VERSIONS
|
||||
val kotestVersion: String by project
|
||||
val kotlinSerializeVersion: String by project
|
||||
val ktorVersion: String by project
|
||||
val detektVersion: String by project
|
||||
|
||||
// IMPLEMENTATION
|
||||
|
||||
api(projects.kompendiumOas)
|
||||
api(projects.kompendiumJsonSchema)
|
||||
|
||||
implementation("io.ktor:ktor-server-core:$ktorVersion")
|
||||
implementation("io.ktor:ktor-server-cio:$ktorVersion")
|
||||
implementation("io.ktor:ktor-server-html-builder:$ktorVersion")
|
||||
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
||||
|
||||
// Formatting
|
||||
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
|
||||
|
||||
// TEST FIXTURES
|
||||
|
||||
testFixturesApi("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
|
||||
testFixturesApi("io.kotest:kotest-assertions-core-jvm:$kotestVersion")
|
||||
testFixturesApi("io.kotest:kotest-property-jvm:$kotestVersion")
|
||||
testFixturesApi("io.kotest:kotest-assertions-json-jvm:$kotestVersion")
|
||||
testFixturesApi("io.kotest.extensions:kotest-assertions-ktor:2.0.0")
|
||||
|
||||
testFixturesApi("io.ktor:ktor-server-core:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-server-test-host:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-serialization:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-server-content-negotiation:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-server-auth:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-server-auth-jwt:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-client:$ktorVersion")
|
||||
testFixturesApi("io.ktor:ktor-client-cio:$ktorVersion")
|
||||
|
||||
testFixturesApi("dev.forst:ktor-api-key:2.2.4")
|
||||
|
||||
testFixturesApi("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializeVersion")
|
||||
}
|
||||
|
||||
testing {
|
||||
suites {
|
||||
named("test", JvmTestSuite::class) {
|
||||
useJUnitJupiter()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package io.bkbn.kompendium.core.attribute
|
||||
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||
import io.ktor.util.AttributeKey
|
||||
|
||||
object KompendiumAttributes {
|
||||
val openApiSpec = AttributeKey<OpenApiSpec>("OpenApiSpec")
|
||||
val schemaConfigurator = AttributeKey<SchemaConfigurator>("SchemaConfigurator")
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
class DeleteInfo private constructor(
|
||||
override val response: ResponseInfo,
|
||||
override val errors: MutableList<ResponseInfo>,
|
||||
override val tags: Set<String>,
|
||||
override val summary: String,
|
||||
override val description: String,
|
||||
override val externalDocumentation: ExternalDocumentation?,
|
||||
override val security: Map<String, List<String>>?,
|
||||
override val operationId: String?,
|
||||
override val deprecated: Boolean,
|
||||
override val parameters: List<Parameter>
|
||||
) : MethodInfo {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): DeleteInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder : MethodInfo.Builder<DeleteInfo>() {
|
||||
override fun build() = DeleteInfo(
|
||||
response = response ?: error("Response info must be present"),
|
||||
errors = errors,
|
||||
tags = tags,
|
||||
summary = summary ?: error("Summary must be present"),
|
||||
description = description ?: error("Description must be present"),
|
||||
externalDocumentation = externalDocumentation,
|
||||
operationId = operationId,
|
||||
deprecated = deprecated,
|
||||
parameters = parameters,
|
||||
security = security
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
class GetInfo private constructor(
|
||||
override val response: ResponseInfo,
|
||||
override val errors: MutableList<ResponseInfo>,
|
||||
override val tags: Set<String>,
|
||||
override val summary: String,
|
||||
override val description: String,
|
||||
override val externalDocumentation: ExternalDocumentation?,
|
||||
override val operationId: String?,
|
||||
override val deprecated: Boolean,
|
||||
override val parameters: List<Parameter>,
|
||||
override val security: Map<String, List<String>>?
|
||||
) : MethodInfo {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): GetInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder : MethodInfo.Builder<GetInfo>() {
|
||||
override fun build() = GetInfo(
|
||||
response = response ?: error("You must provide a response in order to notarize a GET"),
|
||||
errors = errors,
|
||||
tags = tags,
|
||||
summary = summary ?: error("You must provide a summary in order to notarize a GET"),
|
||||
description = description ?: error("You must provide a description in order to notarize a GET"),
|
||||
externalDocumentation = externalDocumentation,
|
||||
operationId = operationId,
|
||||
deprecated = deprecated,
|
||||
parameters = parameters,
|
||||
security = security
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
class HeadInfo private constructor(
|
||||
override val response: ResponseInfo,
|
||||
override val errors: MutableList<ResponseInfo>,
|
||||
override val tags: Set<String>,
|
||||
override val summary: String,
|
||||
override val description: String,
|
||||
override val externalDocumentation: ExternalDocumentation?,
|
||||
override val operationId: String?,
|
||||
override val deprecated: Boolean,
|
||||
override val parameters: List<Parameter>,
|
||||
override val security: Map<String, List<String>>?,
|
||||
) : MethodInfo {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): HeadInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder : MethodInfo.Builder<HeadInfo>() {
|
||||
override fun build() = HeadInfo(
|
||||
response = response ?: error("Response info must be present"),
|
||||
errors = errors,
|
||||
tags = tags,
|
||||
summary = summary ?: error("Summary must be present"),
|
||||
description = description ?: error("Description must be present"),
|
||||
externalDocumentation = externalDocumentation,
|
||||
operationId = operationId,
|
||||
deprecated = deprecated,
|
||||
parameters = parameters,
|
||||
security = security,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
sealed interface MethodInfo {
|
||||
val response: ResponseInfo
|
||||
val errors: List<ResponseInfo>
|
||||
val tags: Set<String>
|
||||
val summary: String
|
||||
val description: String
|
||||
|
||||
val security: Map<String, List<String>>?
|
||||
get() = null
|
||||
val externalDocumentation: ExternalDocumentation?
|
||||
get() = null
|
||||
val operationId: String?
|
||||
get() = null
|
||||
val deprecated: Boolean
|
||||
get() = false
|
||||
val parameters: List<Parameter>
|
||||
get() = emptyList()
|
||||
|
||||
abstract class Builder<T : MethodInfo> {
|
||||
internal var response: ResponseInfo? = null
|
||||
internal var summary: String? = null
|
||||
internal var description: String? = null
|
||||
internal var externalDocumentation: ExternalDocumentation? = null
|
||||
internal var operationId: String? = null
|
||||
internal var deprecated: Boolean = false
|
||||
internal var tags: Set<String> = emptySet()
|
||||
internal var parameters: List<Parameter> = emptyList()
|
||||
internal var errors: MutableList<ResponseInfo> = mutableListOf()
|
||||
internal var security: Map<String, List<String>>? = null
|
||||
|
||||
fun response(init: ResponseInfo.Builder.() -> Unit) = apply {
|
||||
val builder = ResponseInfo.Builder()
|
||||
builder.init()
|
||||
this.response = builder.build()
|
||||
}
|
||||
|
||||
fun canRespond(init: ResponseInfo.Builder.() -> Unit) = apply {
|
||||
val builder = ResponseInfo.Builder()
|
||||
builder.init()
|
||||
errors.add(builder.build())
|
||||
}
|
||||
|
||||
fun canRespond(responses: List<ResponseInfo>) = apply {
|
||||
errors.addAll(responses)
|
||||
}
|
||||
|
||||
fun summary(s: String) = apply { this.summary = s }
|
||||
|
||||
fun description(s: String) = apply { this.description = s }
|
||||
|
||||
fun externalDocumentation(docs: ExternalDocumentation) = apply { this.externalDocumentation = docs }
|
||||
|
||||
fun operationId(id: String) = apply { this.operationId = id }
|
||||
|
||||
fun isDeprecated() = apply { this.deprecated = true }
|
||||
|
||||
fun tags(vararg tags: String) = apply { this.tags = tags.toSet() }
|
||||
|
||||
fun parameters(vararg parameters: Parameter) = apply { this.parameters = parameters.toList() }
|
||||
|
||||
fun security(security: Map<String, List<String>>) = apply { this.security = security }
|
||||
|
||||
abstract fun build(): T
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
sealed interface MethodInfoWithRequest : MethodInfo {
|
||||
val request: RequestInfo?
|
||||
|
||||
abstract class Builder<T : MethodInfoWithRequest> : MethodInfo.Builder<T>() {
|
||||
internal var request: RequestInfo? = null
|
||||
|
||||
fun request(init: RequestInfo.Builder.() -> Unit) = apply {
|
||||
val builder = RequestInfo.Builder()
|
||||
builder.init()
|
||||
this.request = builder.build()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
class OptionsInfo private constructor(
|
||||
override val response: ResponseInfo,
|
||||
override val errors: MutableList<ResponseInfo>,
|
||||
override val tags: Set<String>,
|
||||
override val summary: String,
|
||||
override val description: String,
|
||||
override val externalDocumentation: ExternalDocumentation?,
|
||||
override val operationId: String?,
|
||||
override val deprecated: Boolean,
|
||||
override val parameters: List<Parameter>,
|
||||
override val security: Map<String, List<String>>?,
|
||||
) : MethodInfo {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): OptionsInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder : MethodInfo.Builder<OptionsInfo>() {
|
||||
override fun build() = OptionsInfo(
|
||||
response = response ?: error("Response info must be provided!"),
|
||||
errors = errors,
|
||||
tags = tags,
|
||||
summary = summary ?: error("Summary must be provided!"),
|
||||
description = description ?: error("Description must be provided!"),
|
||||
externalDocumentation = externalDocumentation,
|
||||
operationId = operationId,
|
||||
deprecated = deprecated,
|
||||
parameters = parameters,
|
||||
security = security,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
class PatchInfo private constructor(
|
||||
override val request: RequestInfo?,
|
||||
override val errors: MutableList<ResponseInfo>,
|
||||
override val response: ResponseInfo,
|
||||
override val tags: Set<String>,
|
||||
override val summary: String,
|
||||
override val description: String,
|
||||
override val externalDocumentation: ExternalDocumentation?,
|
||||
override val operationId: String?,
|
||||
override val deprecated: Boolean,
|
||||
override val parameters: List<Parameter>,
|
||||
override val security: Map<String, List<String>>?,
|
||||
) : MethodInfoWithRequest {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): PatchInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder : MethodInfoWithRequest.Builder<PatchInfo>() {
|
||||
override fun build() = PatchInfo(
|
||||
request = request,
|
||||
errors = errors,
|
||||
response = response ?: error("response info must be present"),
|
||||
tags = tags,
|
||||
summary = summary ?: error("Summary must be present"),
|
||||
description = description ?: error("Description must be present"),
|
||||
externalDocumentation = externalDocumentation,
|
||||
operationId = operationId,
|
||||
deprecated = deprecated,
|
||||
parameters = parameters,
|
||||
security = security,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
class PostInfo private constructor(
|
||||
override val request: RequestInfo?,
|
||||
override val errors: MutableList<ResponseInfo>,
|
||||
override val response: ResponseInfo,
|
||||
override val tags: Set<String>,
|
||||
override val summary: String,
|
||||
override val description: String,
|
||||
override val externalDocumentation: ExternalDocumentation?,
|
||||
override val operationId: String?,
|
||||
override val deprecated: Boolean,
|
||||
override val parameters: List<Parameter>,
|
||||
override val security: Map<String, List<String>>?,
|
||||
) : MethodInfoWithRequest {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): PostInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder : MethodInfoWithRequest.Builder<PostInfo>() {
|
||||
override fun build() = PostInfo(
|
||||
request = request,
|
||||
errors = errors,
|
||||
response = response ?: error("response info must be present"),
|
||||
tags = tags,
|
||||
summary = summary ?: error("Summary must be present"),
|
||||
description = description ?: error("Description must be present"),
|
||||
externalDocumentation = externalDocumentation,
|
||||
operationId = operationId,
|
||||
deprecated = deprecated,
|
||||
parameters = parameters,
|
||||
security = security,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
class PutInfo private constructor(
|
||||
override val request: RequestInfo?,
|
||||
override val errors: MutableList<ResponseInfo>,
|
||||
override val response: ResponseInfo,
|
||||
override val tags: Set<String>,
|
||||
override val summary: String,
|
||||
override val description: String,
|
||||
override val externalDocumentation: ExternalDocumentation?,
|
||||
override val operationId: String?,
|
||||
override val deprecated: Boolean,
|
||||
override val parameters: List<Parameter>,
|
||||
override val security: Map<String, List<String>>?,
|
||||
) : MethodInfoWithRequest {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): PutInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder : MethodInfoWithRequest.Builder<PutInfo>() {
|
||||
override fun build() = PutInfo(
|
||||
request = request,
|
||||
errors = errors,
|
||||
response = response ?: error("response info must be present"),
|
||||
tags = tags,
|
||||
summary = summary ?: error("Summary must be present"),
|
||||
description = description ?: error("Description must be present"),
|
||||
externalDocumentation = externalDocumentation,
|
||||
operationId = operationId,
|
||||
deprecated = deprecated,
|
||||
parameters = parameters,
|
||||
security = security,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.enrichment.TypeEnrichment
|
||||
import io.bkbn.kompendium.oas.payload.MediaType
|
||||
import kotlin.reflect.KType
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
class RequestInfo private constructor(
|
||||
val requestType: KType,
|
||||
val enrichment: TypeEnrichment<*>?,
|
||||
val description: String,
|
||||
val examples: Map<String, MediaType.Example>?,
|
||||
val mediaTypes: Set<String>,
|
||||
val required: Boolean
|
||||
) {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): RequestInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder {
|
||||
private var requestType: KType? = null
|
||||
private var typeEnrichment: TypeEnrichment<*>? = null
|
||||
private var description: String? = null
|
||||
private var examples: Map<String, MediaType.Example>? = null
|
||||
private var mediaTypes: Set<String>? = null
|
||||
private var required: Boolean? = null
|
||||
|
||||
fun required(r: Boolean) = apply {
|
||||
this.required = r
|
||||
}
|
||||
|
||||
fun requestType(t: KType) = apply {
|
||||
this.requestType = t
|
||||
}
|
||||
|
||||
fun enrichment(t: TypeEnrichment<*>) = apply {
|
||||
this.typeEnrichment = t
|
||||
}
|
||||
|
||||
inline fun <reified T> requestType(enrichment: TypeEnrichment<T>? = null) = apply {
|
||||
requestType(typeOf<T>())
|
||||
enrichment?.let { enrichment(it) }
|
||||
}
|
||||
|
||||
fun description(s: String) = apply { this.description = s }
|
||||
|
||||
fun examples(vararg e: Pair<String, MediaType.Example>) = apply {
|
||||
this.examples = e.toMap()
|
||||
}
|
||||
|
||||
fun mediaTypes(vararg m: String) = apply {
|
||||
this.mediaTypes = m.toSet()
|
||||
}
|
||||
|
||||
fun build() = RequestInfo(
|
||||
requestType = requestType ?: error("Request type must be present"),
|
||||
description = description ?: error("Description must be present"),
|
||||
enrichment = typeEnrichment,
|
||||
examples = examples,
|
||||
mediaTypes = mediaTypes ?: setOf("application/json"),
|
||||
required = required ?: true
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package io.bkbn.kompendium.core.metadata
|
||||
|
||||
import io.bkbn.kompendium.enrichment.TypeEnrichment
|
||||
import io.bkbn.kompendium.oas.payload.Header
|
||||
import io.bkbn.kompendium.oas.payload.MediaType
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import kotlin.reflect.KType
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
class ResponseInfo private constructor(
|
||||
val responseCode: HttpStatusCode,
|
||||
val responseType: KType,
|
||||
val enrichment: TypeEnrichment<*>?,
|
||||
val description: String,
|
||||
val examples: Map<String, MediaType.Example>?,
|
||||
val mediaTypes: Set<String>,
|
||||
val responseHeaders: Map<String, Header>?
|
||||
) {
|
||||
|
||||
companion object {
|
||||
fun builder(init: Builder.() -> Unit): ResponseInfo {
|
||||
val builder = Builder()
|
||||
builder.init()
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
class Builder {
|
||||
private var responseCode: HttpStatusCode? = null
|
||||
private var responseType: KType? = null
|
||||
private var typeEnrichment: TypeEnrichment<*>? = null
|
||||
private var description: String? = null
|
||||
private var examples: Map<String, MediaType.Example>? = null
|
||||
private var mediaTypes: Set<String>? = null
|
||||
private var responseHeaders: Map<String, Header>? = null
|
||||
|
||||
fun responseHeaders(headers: Map<String, Header>) = apply {
|
||||
this.responseHeaders = headers
|
||||
}
|
||||
|
||||
fun responseCode(code: HttpStatusCode) = apply {
|
||||
this.responseCode = code
|
||||
}
|
||||
|
||||
fun responseType(t: KType) = apply {
|
||||
this.responseType = t
|
||||
}
|
||||
|
||||
fun enrichment(t: TypeEnrichment<*>) = apply {
|
||||
this.typeEnrichment = t
|
||||
}
|
||||
|
||||
inline fun <reified T> responseType(enrichment: TypeEnrichment<T>? = null) = apply {
|
||||
responseType(typeOf<T>())
|
||||
enrichment?.let { enrichment(it) }
|
||||
}
|
||||
|
||||
fun description(s: String) = apply { this.description = s }
|
||||
|
||||
fun examples(vararg e: Pair<String, MediaType.Example>) = apply {
|
||||
this.examples = e.toMap()
|
||||
}
|
||||
|
||||
fun mediaTypes(vararg m: String) = apply {
|
||||
this.mediaTypes = m.toSet()
|
||||
}
|
||||
|
||||
fun build() = ResponseInfo(
|
||||
responseCode = responseCode ?: error("You must provide a response code in order to build a Response!"),
|
||||
responseType = responseType ?: error("You must provide a response type in order to build a Response!"),
|
||||
description = description ?: error("You must provide a description in order to build a Response!"),
|
||||
enrichment = typeEnrichment,
|
||||
examples = examples,
|
||||
mediaTypes = mediaTypes ?: setOf("application/json"),
|
||||
responseHeaders = responseHeaders
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package io.bkbn.kompendium.core.plugin
|
||||
|
||||
import io.bkbn.kompendium.core.attribute.KompendiumAttributes
|
||||
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||
import io.bkbn.kompendium.json.schema.util.Helpers.getSimpleSlug
|
||||
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||
import io.ktor.server.application.createApplicationPlugin
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.routing.Routing
|
||||
import io.ktor.server.routing.get
|
||||
import io.ktor.server.routing.route
|
||||
import io.ktor.server.routing.routing
|
||||
import kotlin.reflect.KType
|
||||
|
||||
object NotarizedApplication {
|
||||
|
||||
class Config {
|
||||
lateinit var spec: () -> OpenApiSpec
|
||||
var specRoute: (OpenApiSpec, Routing) -> Unit = { spec, routing ->
|
||||
routing.route("/openapi.json") {
|
||||
get {
|
||||
call.respond(spec)
|
||||
}
|
||||
}
|
||||
}
|
||||
var customTypes: Map<KType, JsonSchema> = emptyMap()
|
||||
var schemaConfigurator: SchemaConfigurator = KotlinXSchemaConfigurator()
|
||||
}
|
||||
|
||||
operator fun invoke() = createApplicationPlugin(
|
||||
name = "NotarizedApplication",
|
||||
createConfiguration = ::Config
|
||||
) {
|
||||
val spec = pluginConfig.spec()
|
||||
val routing = application.routing {}
|
||||
this@createApplicationPlugin.pluginConfig.specRoute(spec, routing)
|
||||
// pluginConfig.openApiJson(routing)
|
||||
pluginConfig.customTypes.forEach { (type, schema) ->
|
||||
spec.components.schemas[type.getSimpleSlug()] = schema
|
||||
}
|
||||
application.attributes.put(KompendiumAttributes.openApiSpec, spec)
|
||||
application.attributes.put(KompendiumAttributes.schemaConfigurator, pluginConfig.schemaConfigurator)
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package io.bkbn.kompendium.core.plugin
|
||||
|
||||
import io.bkbn.kompendium.core.attribute.KompendiumAttributes
|
||||
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||
import io.bkbn.kompendium.core.util.Helpers.addToSpec
|
||||
import io.bkbn.kompendium.core.util.SpecConfig
|
||||
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||
import io.bkbn.kompendium.oas.path.Path
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.server.application.ApplicationCallPipeline
|
||||
import io.ktor.server.application.Hook
|
||||
import io.ktor.server.application.PluginBuilder
|
||||
import io.ktor.server.application.createRouteScopedPlugin
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.application
|
||||
|
||||
object NotarizedRoute {
|
||||
class Config : SpecConfig {
|
||||
override var tags: Set<String> = emptySet()
|
||||
override var parameters: List<Parameter> = emptyList()
|
||||
override var get: GetInfo? = null
|
||||
override var post: PostInfo? = null
|
||||
override var put: PutInfo? = null
|
||||
override var delete: DeleteInfo? = null
|
||||
override var patch: PatchInfo? = null
|
||||
override var head: HeadInfo? = null
|
||||
override var options: OptionsInfo? = null
|
||||
override var security: Map<String, List<String>>? = null
|
||||
}
|
||||
|
||||
private object InstallHook : Hook<(ApplicationCallPipeline) -> Unit> {
|
||||
override fun install(pipeline: ApplicationCallPipeline, handler: (ApplicationCallPipeline) -> Unit) {
|
||||
handler(pipeline)
|
||||
}
|
||||
}
|
||||
|
||||
operator fun invoke() = createRouteScopedPlugin(
|
||||
name = "NotarizedRoute",
|
||||
createConfiguration = ::Config
|
||||
) {
|
||||
// This is required in order to introspect the route path and authentication
|
||||
on(InstallHook) {
|
||||
val route = it as? Route ?: return@on
|
||||
val spec = application.attributes[KompendiumAttributes.openApiSpec]
|
||||
val routePath = route.calculateRoutePath()
|
||||
val authMethods = route.collectAuthMethods()
|
||||
|
||||
addToSpec(spec, routePath, authMethods)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : SpecConfig> PluginBuilder<T>.addToSpec(
|
||||
spec: OpenApiSpec,
|
||||
fullPath: String,
|
||||
authMethods: List<String>
|
||||
) {
|
||||
val path = spec.paths[fullPath] ?: Path()
|
||||
|
||||
path.parameters = path.parameters?.plus(pluginConfig.parameters) ?: pluginConfig.parameters
|
||||
val serializableReader = application.attributes[KompendiumAttributes.schemaConfigurator]
|
||||
|
||||
pluginConfig.get?.addToSpec(path, spec, pluginConfig, serializableReader, fullPath, authMethods)
|
||||
pluginConfig.delete?.addToSpec(path, spec, pluginConfig, serializableReader, fullPath, authMethods)
|
||||
pluginConfig.head?.addToSpec(path, spec, pluginConfig, serializableReader, fullPath, authMethods)
|
||||
pluginConfig.options?.addToSpec(path, spec, pluginConfig, serializableReader, fullPath, authMethods)
|
||||
pluginConfig.post?.addToSpec(path, spec, pluginConfig, serializableReader, fullPath, authMethods)
|
||||
pluginConfig.put?.addToSpec(path, spec, pluginConfig, serializableReader, fullPath, authMethods)
|
||||
pluginConfig.patch?.addToSpec(path, spec, pluginConfig, serializableReader, fullPath, authMethods)
|
||||
|
||||
spec.paths[fullPath] = path
|
||||
}
|
||||
|
||||
fun Route.calculateRoutePath() = toString()
|
||||
.let {
|
||||
application.rootPath.takeIf { root -> root.isNotEmpty() }
|
||||
?.let { root ->
|
||||
val sanitizedRoute = if (root.startsWith("/")) root else "/$root"
|
||||
it.replace(sanitizedRoute, "")
|
||||
}
|
||||
?: it
|
||||
}
|
||||
.replace(Regex("/\\(.+\\)"), "")
|
||||
.replace(Regex("/\\[.+\\]"), "")
|
||||
|
||||
fun Route.collectAuthMethods() = toString()
|
||||
.split("/")
|
||||
.filter { it.contains(Regex("\\(authenticate .*\\)")) }
|
||||
.map { it.replace("(authenticate ", "").replace(")", "") }
|
||||
.map { it.split(", ") }
|
||||
.flatten()
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
package io.bkbn.kompendium.routes
|
||||
package io.bkbn.kompendium.core.routes
|
||||
|
||||
import io.ktor.application.call
|
||||
import io.ktor.html.respondHtml
|
||||
import io.ktor.routing.Routing
|
||||
import io.ktor.routing.get
|
||||
import io.ktor.routing.route
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.application.call
|
||||
import io.ktor.server.html.respondHtml
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.get
|
||||
import io.ktor.server.routing.route
|
||||
import kotlinx.html.body
|
||||
import kotlinx.html.head
|
||||
import kotlinx.html.link
|
||||
@ -13,20 +14,20 @@ import kotlinx.html.script
|
||||
import kotlinx.html.style
|
||||
import kotlinx.html.title
|
||||
import kotlinx.html.unsafe
|
||||
import io.bkbn.kompendium.models.oas.OpenApiSpec
|
||||
|
||||
/**
|
||||
* Provides an out-of-the-box route to view docs using ReDoc
|
||||
* @param oas spec to reference
|
||||
* Provides an out-of-the-box route to view docs using ReDoc on the specified [path].
|
||||
* @param pageTitle Webpage title you wish to be displayed on your docs
|
||||
* @param path path to docs resource
|
||||
* @param specUrl url to point ReDoc to the OpenAPI json document
|
||||
*/
|
||||
fun Routing.redoc(oas: OpenApiSpec, specUrl: String = "/openapi.json") {
|
||||
route("/docs") {
|
||||
fun Route.redoc(pageTitle: String = "Docs", path: String = "/docs", specUrl: String = "/openapi.json") {
|
||||
route(path) {
|
||||
get {
|
||||
call.respondHtml {
|
||||
call.respondHtml(HttpStatusCode.OK) {
|
||||
head {
|
||||
title {
|
||||
+"${oas.info.title}"
|
||||
+pageTitle
|
||||
}
|
||||
meta {
|
||||
charset = "utf-8"
|
||||
@ -46,7 +47,7 @@ fun Routing.redoc(oas: OpenApiSpec, specUrl: String = "/openapi.json") {
|
||||
}
|
||||
}
|
||||
body {
|
||||
unsafe { +"<redoc spec-url='${specUrl}'></redoc>" }
|
||||
unsafe { +"<redoc spec-url='$specUrl'></redoc>" }
|
||||
script {
|
||||
src = "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package io.bkbn.kompendium.core.routes
|
||||
|
||||
import io.ktor.server.application.call
|
||||
import io.ktor.server.html.respondHtml
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.get
|
||||
import io.ktor.server.routing.route
|
||||
import kotlinx.html.body
|
||||
import kotlinx.html.div
|
||||
import kotlinx.html.head
|
||||
import kotlinx.html.id
|
||||
import kotlinx.html.link
|
||||
import kotlinx.html.meta
|
||||
import kotlinx.html.script
|
||||
import kotlinx.html.title
|
||||
import kotlinx.html.unsafe
|
||||
|
||||
/**
|
||||
* Provides an out-of-the-box route to view docs using Swagger
|
||||
* @see <a href="https://swagger.io/specification/">Swagger OpenApi Specification</a>
|
||||
* for the latest supported open api version.
|
||||
* @param pageTitle Webpage title you wish to be displayed on your docs
|
||||
* @param path path to docs resource
|
||||
* @param specUrl url to point Swagger to the OpenAPI json document
|
||||
* @param swaggerVersion version of swagger-ui distribution
|
||||
*/
|
||||
fun Route.swagger(
|
||||
pageTitle: String = "Docs",
|
||||
path: String = "/swagger-ui",
|
||||
specUrl: String = "/openapi.json",
|
||||
swaggerVersion: String? = null
|
||||
) {
|
||||
val swaggerVersionSuffix = if (swaggerVersion == null) "" else "@$swaggerVersion"
|
||||
|
||||
route(path) {
|
||||
get {
|
||||
call.respondHtml {
|
||||
head {
|
||||
title {
|
||||
+pageTitle
|
||||
}
|
||||
meta {
|
||||
charset = "utf-8"
|
||||
}
|
||||
meta {
|
||||
name = "viewport"
|
||||
content = "width=device-width, initial-scale=1"
|
||||
}
|
||||
link {
|
||||
href = "https://unpkg.com/swagger-ui-dist$swaggerVersionSuffix/swagger-ui.css"
|
||||
rel = "stylesheet"
|
||||
}
|
||||
}
|
||||
body {
|
||||
div {
|
||||
id = "swagger-ui"
|
||||
}
|
||||
script {
|
||||
src = "https://unpkg.com/swagger-ui-dist$swaggerVersionSuffix/swagger-ui-standalone-preset.js"
|
||||
}
|
||||
script {
|
||||
src = "https://unpkg.com/swagger-ui-dist$swaggerVersionSuffix/swagger-ui-bundle.js"
|
||||
}
|
||||
unsafe {
|
||||
+"""
|
||||
<script>
|
||||
window.onload = function () {
|
||||
// Build a system
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "$specUrl",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout",
|
||||
})
|
||||
window.ui = ui
|
||||
}
|
||||
</script>
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
212
core/src/main/kotlin/io/bkbn/kompendium/core/util/Helpers.kt
Normal file
212
core/src/main/kotlin/io/bkbn/kompendium/core/util/Helpers.kt
Normal file
@ -0,0 +1,212 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||
import io.bkbn.kompendium.core.metadata.MethodInfo
|
||||
import io.bkbn.kompendium.core.metadata.MethodInfoWithRequest
|
||||
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||
import io.bkbn.kompendium.core.metadata.ResponseInfo
|
||||
import io.bkbn.kompendium.enrichment.TypeEnrichment
|
||||
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||
import io.bkbn.kompendium.json.schema.definition.NullableDefinition
|
||||
import io.bkbn.kompendium.json.schema.definition.OneOfDefinition
|
||||
import io.bkbn.kompendium.json.schema.definition.ReferenceDefinition
|
||||
import io.bkbn.kompendium.json.schema.util.Helpers.getReferenceSlug
|
||||
import io.bkbn.kompendium.json.schema.util.Helpers.getSlug
|
||||
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||
import io.bkbn.kompendium.oas.path.Path
|
||||
import io.bkbn.kompendium.oas.path.PathOperation
|
||||
import io.bkbn.kompendium.oas.payload.MediaType
|
||||
import io.bkbn.kompendium.oas.payload.Request
|
||||
import io.bkbn.kompendium.oas.payload.Response
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.KType
|
||||
|
||||
object Helpers {
|
||||
|
||||
private fun PathOperation.addDefaultAuthMethods(methods: List<String>) {
|
||||
methods.forEach { m ->
|
||||
if (security == null || security?.all { s -> !s.containsKey(m) } == true) {
|
||||
if (security == null) {
|
||||
security = mutableListOf(mapOf(m to emptyList()))
|
||||
} else {
|
||||
security?.add(mapOf(m to emptyList()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("CyclomaticComplexMethod")
|
||||
fun MethodInfo.addToSpec(
|
||||
path: Path,
|
||||
spec: OpenApiSpec,
|
||||
config: SpecConfig,
|
||||
schemaConfigurator: SchemaConfigurator,
|
||||
routePath: String,
|
||||
authMethods: List<String> = emptyList()
|
||||
) {
|
||||
val type = this.response.responseType
|
||||
val enrichment = this.response.enrichment
|
||||
SchemaGenerator.fromTypeOrUnit(
|
||||
type = type,
|
||||
cache = spec.components.schemas,
|
||||
schemaConfigurator = schemaConfigurator,
|
||||
enrichment = enrichment,
|
||||
)?.let { schema ->
|
||||
val slug = type.getSlug(enrichment)
|
||||
spec.components.schemas[slug] = schema
|
||||
}
|
||||
|
||||
errors.forEach { error ->
|
||||
val errorEnrichment = error.enrichment
|
||||
val errorType = error.responseType
|
||||
SchemaGenerator.fromTypeOrUnit(
|
||||
type = errorType,
|
||||
cache = spec.components.schemas,
|
||||
schemaConfigurator = schemaConfigurator,
|
||||
enrichment = errorEnrichment,
|
||||
)?.let { schema ->
|
||||
val slug = errorType.getSlug(errorEnrichment)
|
||||
spec.components.schemas[slug] = schema
|
||||
}
|
||||
}
|
||||
|
||||
when (this) {
|
||||
is MethodInfoWithRequest -> {
|
||||
this.request?.let { reqInfo ->
|
||||
val reqEnrichment = reqInfo.enrichment
|
||||
val reqType = reqInfo.requestType
|
||||
SchemaGenerator.fromTypeOrUnit(
|
||||
type = reqType,
|
||||
cache = spec.components.schemas,
|
||||
schemaConfigurator = schemaConfigurator,
|
||||
enrichment = reqEnrichment,
|
||||
)?.let { schema ->
|
||||
val slug = reqType.getSlug(reqEnrichment)
|
||||
spec.components.schemas[slug] = schema
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
|
||||
val operations = this.toPathOperation(config)
|
||||
operations.addDefaultAuthMethods(authMethods)
|
||||
|
||||
fun setOperation(
|
||||
property: KMutableProperty1<Path, PathOperation?>
|
||||
) {
|
||||
require(property.get(path) == null) {
|
||||
"A route has already been registered for path: $routePath and method: ${property.name.uppercase()}"
|
||||
}
|
||||
property.set(path, operations)
|
||||
}
|
||||
|
||||
return when (this) {
|
||||
is DeleteInfo -> setOperation(Path::delete)
|
||||
is GetInfo -> setOperation(Path::get)
|
||||
is HeadInfo -> setOperation(Path::head)
|
||||
is PatchInfo -> setOperation(Path::patch)
|
||||
is PostInfo -> setOperation(Path::post)
|
||||
is PutInfo -> setOperation(Path::put)
|
||||
is OptionsInfo -> setOperation(Path::options)
|
||||
}
|
||||
}
|
||||
|
||||
private fun MethodInfo.toPathOperation(config: SpecConfig) = PathOperation(
|
||||
tags = config.tags.plus(this.tags),
|
||||
summary = this.summary,
|
||||
description = this.description,
|
||||
externalDocs = this.externalDocumentation,
|
||||
operationId = this.operationId,
|
||||
deprecated = this.deprecated,
|
||||
parameters = this.parameters,
|
||||
security = this.createCombinedSecurityContext(config),
|
||||
requestBody = when (this) {
|
||||
is MethodInfoWithRequest -> this.request?.let { reqInfo ->
|
||||
Request(
|
||||
description = reqInfo.description,
|
||||
content = reqInfo.requestType.toReferenceContent(
|
||||
examples = reqInfo.examples,
|
||||
mediaTypes = reqInfo.mediaTypes,
|
||||
enrichment = reqInfo.enrichment
|
||||
),
|
||||
required = reqInfo.required
|
||||
)
|
||||
}
|
||||
|
||||
else -> null
|
||||
},
|
||||
responses = mapOf(
|
||||
this.response.responseCode.value to Response(
|
||||
description = this.response.description,
|
||||
headers = this.response.responseHeaders,
|
||||
content = this.response.responseType.toReferenceContent(
|
||||
examples = this.response.examples,
|
||||
mediaTypes = this.response.mediaTypes,
|
||||
enrichment = this.response.enrichment
|
||||
)
|
||||
)
|
||||
).plus(this.errors.toResponseMap())
|
||||
)
|
||||
|
||||
private fun MethodInfo.createCombinedSecurityContext(config: SpecConfig): MutableList<Map<String, List<String>>>? {
|
||||
val configSecurity = config.security
|
||||
?.map { (k, v) -> k to v }
|
||||
?.map { listOf(it).toMap() }
|
||||
?.toMutableList()
|
||||
|
||||
val methodSecurity = this.security
|
||||
?.map { (k, v) -> k to v }
|
||||
?.map { listOf(it).toMap() }
|
||||
?.toMutableList()
|
||||
|
||||
return when {
|
||||
configSecurity == null && methodSecurity == null -> null
|
||||
configSecurity == null -> methodSecurity
|
||||
methodSecurity == null -> configSecurity
|
||||
else -> configSecurity.plus(methodSecurity).toMutableList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun List<ResponseInfo>.toResponseMap(): Map<Int, Response> = associate { error ->
|
||||
error.responseCode.value to Response(
|
||||
description = error.description,
|
||||
headers = error.responseHeaders,
|
||||
content = error.responseType.toReferenceContent(
|
||||
examples = error.examples,
|
||||
mediaTypes = error.mediaTypes,
|
||||
enrichment = error.enrichment
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun KType.toReferenceContent(
|
||||
examples: Map<String, MediaType.Example>?,
|
||||
mediaTypes: Set<String>,
|
||||
enrichment: TypeEnrichment<*>?
|
||||
): Map<String, MediaType>? =
|
||||
when (this.classifier as KClass<*>) {
|
||||
Unit::class -> null
|
||||
else -> mediaTypes.associateWith {
|
||||
MediaType(
|
||||
schema = if (this.isMarkedNullable) {
|
||||
OneOfDefinition(
|
||||
NullableDefinition(),
|
||||
ReferenceDefinition(this.getReferenceSlug(enrichment))
|
||||
)
|
||||
} else {
|
||||
ReferenceDefinition(this.getReferenceSlug(enrichment))
|
||||
},
|
||||
examples = examples
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
|
||||
interface SpecConfig {
|
||||
var tags: Set<String>
|
||||
var parameters: List<Parameter>
|
||||
var get: GetInfo?
|
||||
var post: PostInfo?
|
||||
var put: PutInfo?
|
||||
var delete: DeleteInfo?
|
||||
var patch: PatchInfo?
|
||||
var head: HeadInfo?
|
||||
var options: OptionsInfo?
|
||||
var security: Map<String, List<String>>?
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import dev.forst.ktor.apikey.apiKey
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.customAuthConfig
|
||||
import io.bkbn.kompendium.core.util.customScopesOnSiblingPathOperations
|
||||
import io.bkbn.kompendium.core.util.defaultAuthConfig
|
||||
import io.bkbn.kompendium.core.util.multipleAuthStrategies
|
||||
import io.bkbn.kompendium.oas.component.Components
|
||||
import io.bkbn.kompendium.oas.security.ApiKeyAuth
|
||||
import io.bkbn.kompendium.oas.security.BasicAuth
|
||||
import io.bkbn.kompendium.oas.security.BearerAuth
|
||||
import io.bkbn.kompendium.oas.security.OAuth
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.engine.cio.CIO
|
||||
import io.ktor.http.HttpMethod
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.auth.Authentication
|
||||
import io.ktor.server.auth.OAuthServerSettings
|
||||
import io.ktor.server.auth.Principal
|
||||
import io.ktor.server.auth.UserIdPrincipal
|
||||
import io.ktor.server.auth.basic
|
||||
import io.ktor.server.auth.jwt.jwt
|
||||
import io.ktor.server.auth.oauth
|
||||
|
||||
class KompendiumAuthenticationTest : DescribeSpec({
|
||||
describe("Authentication") {
|
||||
it("Can add a default auth config by default") {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
snapshotName = "T0045__default_auth_config.json",
|
||||
applicationSetup = {
|
||||
install(Authentication) {
|
||||
basic("basic") {
|
||||
realm = "Ktor Server"
|
||||
validate { UserIdPrincipal("Placeholder") }
|
||||
}
|
||||
}
|
||||
},
|
||||
specOverrides = {
|
||||
this.copy(
|
||||
components = Components(
|
||||
securitySchemes = mutableMapOf(
|
||||
"basic" to BasicAuth()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
) { defaultAuthConfig() }
|
||||
}
|
||||
it("Can provide custom auth config with proper scopes") {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
snapshotName = "T0046__custom_auth_config.json",
|
||||
applicationSetup = {
|
||||
install(Authentication) {
|
||||
oauth("auth-oauth-google") {
|
||||
urlProvider = { "http://localhost:8080/callback" }
|
||||
providerLookup = {
|
||||
OAuthServerSettings.OAuth2ServerSettings(
|
||||
name = "google",
|
||||
authorizeUrl = "https://accounts.google.com/o/oauth2/auth",
|
||||
accessTokenUrl = "https://accounts.google.com/o/oauth2/token",
|
||||
requestMethod = HttpMethod.Post,
|
||||
clientId = "DUMMY_VAL",
|
||||
clientSecret = "DUMMY_VAL",
|
||||
defaultScopes = listOf("https://www.googleapis.com/auth/userinfo.profile"),
|
||||
extraTokenParameters = listOf("access_type" to "offline")
|
||||
)
|
||||
}
|
||||
client = HttpClient(CIO)
|
||||
}
|
||||
}
|
||||
},
|
||||
specOverrides = {
|
||||
this.copy(
|
||||
components = Components(
|
||||
securitySchemes = mutableMapOf(
|
||||
"auth-oauth-google" to OAuth(
|
||||
flows = OAuth.Flows(
|
||||
implicit = OAuth.Flows.Implicit(
|
||||
authorizationUrl = "https://accounts.google.com/o/oauth2/auth",
|
||||
scopes = mapOf(
|
||||
"write:pets" to "modify pets in your account",
|
||||
"read:pets" to "read your pets"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
) { customAuthConfig() }
|
||||
}
|
||||
it("Can provide multiple authentication strategies") {
|
||||
data class TestAppPrincipal(val key: String) : Principal
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
snapshotName = "T0047__multiple_auth_strategies.json",
|
||||
applicationSetup = {
|
||||
install(Authentication) {
|
||||
apiKey("api-key") {
|
||||
headerName = "X-API-KEY"
|
||||
validate { key ->
|
||||
// api key library (dev.forst.ktor.apikey) is using the deprecated `Principal` class
|
||||
key
|
||||
.takeIf { it == "api-key" }
|
||||
?.let { TestAppPrincipal(it) }
|
||||
}
|
||||
}
|
||||
jwt("jwt") {
|
||||
realm = "Server"
|
||||
}
|
||||
}
|
||||
},
|
||||
specOverrides = {
|
||||
this.copy(
|
||||
components = Components(
|
||||
securitySchemes = mutableMapOf(
|
||||
"jwt" to BearerAuth("JWT"),
|
||||
"api-key" to ApiKeyAuth(ApiKeyAuth.ApiKeyLocation.HEADER, "X-API-KEY")
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
) { multipleAuthStrategies() }
|
||||
}
|
||||
it("Can provide different scopes on path operations in the same route") {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
snapshotName = "T0074__auth_on_specific_path_operation.json",
|
||||
applicationSetup = {
|
||||
install(Authentication) {
|
||||
oauth("auth-oauth-google") {
|
||||
urlProvider = { "http://localhost:8080/callback" }
|
||||
providerLookup = {
|
||||
OAuthServerSettings.OAuth2ServerSettings(
|
||||
name = "google",
|
||||
authorizeUrl = "https://accounts.google.com/o/oauth2/auth",
|
||||
accessTokenUrl = "https://accounts.google.com/o/oauth2/token",
|
||||
requestMethod = HttpMethod.Post,
|
||||
clientId = "DUMMY_VAL",
|
||||
clientSecret = "DUMMY_VAL",
|
||||
defaultScopes = listOf("https://www.googleapis.com/auth/userinfo.profile"),
|
||||
extraTokenParameters = listOf("access_type" to "offline")
|
||||
)
|
||||
}
|
||||
client = HttpClient(CIO)
|
||||
}
|
||||
}
|
||||
},
|
||||
specOverrides = {
|
||||
this.copy(
|
||||
components = Components(
|
||||
securitySchemes = mutableMapOf(
|
||||
"auth-oauth-google" to OAuth(
|
||||
flows = OAuth.Flows(
|
||||
implicit = OAuth.Flows.Implicit(
|
||||
authorizationUrl = "https://accounts.google.com/o/oauth2/auth",
|
||||
scopes = mapOf(
|
||||
"write:pets" to "modify pets in your account",
|
||||
"read:pets" to "read your pets"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
) { customScopesOnSiblingPathOperations() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,35 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.arrayConstraints
|
||||
import io.bkbn.kompendium.core.util.doubleConstraints
|
||||
import io.bkbn.kompendium.core.util.intConstraints
|
||||
import io.bkbn.kompendium.core.util.stringConstraints
|
||||
import io.bkbn.kompendium.core.util.stringContentEncodingConstraints
|
||||
import io.bkbn.kompendium.core.util.stringPatternConstraints
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumConstraintsTest : DescribeSpec({
|
||||
describe("Constraints") {
|
||||
it("Can apply constraints to an int field") {
|
||||
TestHelpers.openApiTestAllSerializers("T0059__int_constraints.json") { intConstraints() }
|
||||
}
|
||||
it("Can apply constraints to a double field") {
|
||||
TestHelpers.openApiTestAllSerializers("T0060__double_constraints.json") { doubleConstraints() }
|
||||
}
|
||||
it("Can apply a min and max length to a string field") {
|
||||
TestHelpers.openApiTestAllSerializers("T0061__string_min_max_constraints.json") { stringConstraints() }
|
||||
}
|
||||
it("Can apply a pattern to a string field") {
|
||||
TestHelpers.openApiTestAllSerializers("T0062__string_pattern_constraints.json") { stringPatternConstraints() }
|
||||
}
|
||||
it("Can apply a content encoding and media type to a string field") {
|
||||
TestHelpers.openApiTestAllSerializers("T0063__string_content_encoding_constraints.json") {
|
||||
stringContentEncodingConstraints()
|
||||
}
|
||||
}
|
||||
it("Can apply constraints to an array field") {
|
||||
TestHelpers.openApiTestAllSerializers("T0064__array_constraints.json") { arrayConstraints() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,13 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.defaultParameter
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumDefaultsTest : DescribeSpec({
|
||||
describe("Defaults") {
|
||||
it("Can generate a default parameter value") {
|
||||
TestHelpers.openApiTestAllSerializers("T0022__query_with_default_parameter.json") { defaultParameter() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,39 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers.openApiTestAllSerializers
|
||||
import io.bkbn.kompendium.core.util.enrichedComplexGenericType
|
||||
import io.bkbn.kompendium.core.util.enrichedGenericResponse
|
||||
import io.bkbn.kompendium.core.util.enrichedMap
|
||||
import io.bkbn.kompendium.core.util.enrichedNestedCollection
|
||||
import io.bkbn.kompendium.core.util.enrichedSimpleRequest
|
||||
import io.bkbn.kompendium.core.util.enrichedSimpleResponse
|
||||
import io.bkbn.kompendium.core.util.enrichedTopLevelCollection
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumEnrichmentTest : DescribeSpec({
|
||||
describe("Enrichment") {
|
||||
it("Can enrich a simple request") {
|
||||
openApiTestAllSerializers("T0055__enriched_simple_request.json") { enrichedSimpleRequest() }
|
||||
}
|
||||
it("Can enrich a simple response") {
|
||||
openApiTestAllSerializers("T0058__enriched_simple_response.json") { enrichedSimpleResponse() }
|
||||
}
|
||||
it("Can enrich a nested collection") {
|
||||
openApiTestAllSerializers("T0056__enriched_nested_collection.json") { enrichedNestedCollection() }
|
||||
}
|
||||
it("Can enrich a complex generic type") {
|
||||
openApiTestAllSerializers(
|
||||
"T0057__enriched_complex_generic_type.json"
|
||||
) { enrichedComplexGenericType() }
|
||||
}
|
||||
it("Can enrich a generic object") {
|
||||
openApiTestAllSerializers("T0067__enriched_generic_object.json") { enrichedGenericResponse() }
|
||||
}
|
||||
it("Can enrich a top level list type") {
|
||||
openApiTestAllSerializers("T0077__enriched_top_level_list.json") { enrichedTopLevelCollection() }
|
||||
}
|
||||
it("can enrich a map type") {
|
||||
openApiTestAllSerializers("T0078__enriched_top_level_map.json") { enrichedMap() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,45 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.dateTimeString
|
||||
import io.bkbn.kompendium.core.util.samePathSameMethod
|
||||
import io.bkbn.kompendium.json.schema.exception.UnknownSchemaException
|
||||
import io.kotest.assertions.throwables.shouldThrow
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import io.kotest.matchers.should
|
||||
import io.kotest.matchers.string.startWith
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.auth.Authentication
|
||||
import io.ktor.server.auth.UserIdPrincipal
|
||||
import io.ktor.server.auth.basic
|
||||
|
||||
class KompendiumErrorHandlingTest : DescribeSpec({
|
||||
describe("Error Handling") {
|
||||
it("Throws a clear exception when an unidentified type is encountered") {
|
||||
val exception = shouldThrow<UnknownSchemaException> {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
""
|
||||
) { dateTimeString() }
|
||||
}
|
||||
exception.message should startWith("An unknown type was encountered: class java.time.Instant")
|
||||
}
|
||||
it("Throws an exception when same method for same path has been previously registered") {
|
||||
val exception = shouldThrow<IllegalArgumentException> {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
snapshotName = "",
|
||||
applicationSetup = {
|
||||
install(Authentication) {
|
||||
basic("basic") {
|
||||
realm = "Ktor Server"
|
||||
validate { UserIdPrincipal("Placeholder") }
|
||||
}
|
||||
}
|
||||
},
|
||||
) {
|
||||
samePathSameMethod()
|
||||
}
|
||||
}
|
||||
exception.message should startWith("A route has already been registered for path: /test/{a} and method: GET")
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,27 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.exampleParams
|
||||
import io.bkbn.kompendium.core.util.exampleSummaryAndDescription
|
||||
import io.bkbn.kompendium.core.util.optionalReqExample
|
||||
import io.bkbn.kompendium.core.util.reqRespExamples
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumExamplesTest : DescribeSpec({
|
||||
describe("Examples") {
|
||||
it("Can generate example response and request bodies") {
|
||||
TestHelpers.openApiTestAllSerializers("T0020__example_req_and_resp.json") { reqRespExamples() }
|
||||
}
|
||||
it("Can describe example parameters") {
|
||||
TestHelpers.openApiTestAllSerializers("T0021__example_parameters.json") { exampleParams() }
|
||||
}
|
||||
it("Can generate example optional request body") {
|
||||
TestHelpers.openApiTestAllSerializers("T0069__example_optional_req.json") { optionalReqExample() }
|
||||
}
|
||||
it("Can generate example summary and description") {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
"T0075__example_summary_and_description.json"
|
||||
) { exampleSummaryAndDescription() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,27 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.genericException
|
||||
import io.bkbn.kompendium.core.util.multipleExceptions
|
||||
import io.bkbn.kompendium.core.util.polymorphicException
|
||||
import io.bkbn.kompendium.core.util.singleException
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumExceptionsTest : DescribeSpec({
|
||||
describe("Exceptions") {
|
||||
it("Can add an exception status code to a response") {
|
||||
TestHelpers.openApiTestAllSerializers("T0016__notarized_get_with_exception_response.json") { singleException() }
|
||||
}
|
||||
it("Can support multiple response codes") {
|
||||
TestHelpers.openApiTestAllSerializers("T0017__notarized_get_with_multiple_exception_responses.json") {
|
||||
multipleExceptions()
|
||||
}
|
||||
}
|
||||
it("Can add a polymorphic exception response") {
|
||||
TestHelpers.openApiTestAllSerializers("T0018__polymorphic_error_status_codes.json") { polymorphicException() }
|
||||
}
|
||||
it("Can add a generic exception response") {
|
||||
TestHelpers.openApiTestAllSerializers("T0019__generic_exception.json") { genericException() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,7 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumFreeFormTest : DescribeSpec({
|
||||
// todo Assess strategies here
|
||||
})
|
@ -0,0 +1,67 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.genericPolymorphicResponse
|
||||
import io.bkbn.kompendium.core.util.genericPolymorphicResponseMultipleImpls
|
||||
import io.bkbn.kompendium.core.util.gnarlyGenericResponse
|
||||
import io.bkbn.kompendium.core.util.nestedGenericCollection
|
||||
import io.bkbn.kompendium.core.util.nestedGenericMultipleParamsCollection
|
||||
import io.bkbn.kompendium.core.util.nestedGenericResponse
|
||||
import io.bkbn.kompendium.core.util.overrideSealedTypeIdentifier
|
||||
import io.bkbn.kompendium.core.util.polymorphicCollectionResponse
|
||||
import io.bkbn.kompendium.core.util.polymorphicMapResponse
|
||||
import io.bkbn.kompendium.core.util.polymorphicResponse
|
||||
import io.bkbn.kompendium.core.util.simpleGenericResponse
|
||||
import io.bkbn.kompendium.core.util.subtypeNotCompleteSetOfParentProperties
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumPolymorphismAndGenericsTest : DescribeSpec({
|
||||
describe("Polymorphism and Generics") {
|
||||
it("can generate a polymorphic response type") {
|
||||
TestHelpers.openApiTestAllSerializers("T0027__polymorphic_response.json") { polymorphicResponse() }
|
||||
}
|
||||
it("Can generate a collection with polymorphic response type") {
|
||||
TestHelpers.openApiTestAllSerializers("T0028__polymorphic_list_response.json") { polymorphicCollectionResponse() }
|
||||
}
|
||||
it("Can generate a map with a polymorphic response type") {
|
||||
TestHelpers.openApiTestAllSerializers("T0029__polymorphic_map_response.json") { polymorphicMapResponse() }
|
||||
}
|
||||
it("Can generate a response type with a generic type") {
|
||||
TestHelpers.openApiTestAllSerializers("T0030__simple_generic_response.json") { simpleGenericResponse() }
|
||||
}
|
||||
it("Can generate a response type with a nested generic type") {
|
||||
TestHelpers.openApiTestAllSerializers("T0031__nested_generic_response.json") { nestedGenericResponse() }
|
||||
}
|
||||
it("Can generate a polymorphic response type with generics") {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
"T0032__polymorphic_response_with_generics.json"
|
||||
) { genericPolymorphicResponse() }
|
||||
}
|
||||
it("Can handle an absolutely psycho inheritance test") {
|
||||
TestHelpers.openApiTestAllSerializers("T0033__crazy_polymorphic_example.json") {
|
||||
genericPolymorphicResponseMultipleImpls()
|
||||
}
|
||||
}
|
||||
it("Can support nested generic collections") {
|
||||
TestHelpers.openApiTestAllSerializers("T0039__nested_generic_collection.json") { nestedGenericCollection() }
|
||||
}
|
||||
it("Can support nested generics with multiple type parameters") {
|
||||
TestHelpers.openApiTestAllSerializers("T0040__nested_generic_multiple_type_params.json") {
|
||||
nestedGenericMultipleParamsCollection()
|
||||
}
|
||||
}
|
||||
it("Can handle a really gnarly generic example") {
|
||||
TestHelpers.openApiTestAllSerializers("T0043__gnarly_generic_example.json") { gnarlyGenericResponse() }
|
||||
}
|
||||
it("Can override the type name for a sealed interface implementation") {
|
||||
TestHelpers.openApiTestAllSerializers("T0070__sealed_interface_type_name_override.json") {
|
||||
overrideSealedTypeIdentifier()
|
||||
}
|
||||
}
|
||||
it("Can serialize an object where the subtype is not a complete set of parent properties") {
|
||||
TestHelpers.openApiTestAllSerializers("T0071__subtype_not_complete_set_of_parent_properties.json") {
|
||||
subtypeNotCompleteSetOfParentProperties()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,25 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.defaultField
|
||||
import io.bkbn.kompendium.core.util.nonRequiredParam
|
||||
import io.bkbn.kompendium.core.util.nullableField
|
||||
import io.bkbn.kompendium.core.util.requiredParams
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumRequiredFieldsTest : DescribeSpec({
|
||||
describe("Required Fields") {
|
||||
it("Marks a parameter as required if there is no default and it is not marked nullable") {
|
||||
TestHelpers.openApiTestAllSerializers("T0023__required_param.json") { requiredParams() }
|
||||
}
|
||||
it("Can mark a parameter as not required") {
|
||||
TestHelpers.openApiTestAllSerializers("T0024__non_required_param.json") { nonRequiredParam() }
|
||||
}
|
||||
it("Does not mark a field as required if a default value is provided") {
|
||||
TestHelpers.openApiTestAllSerializers("T0025__default_field.json") { defaultField() }
|
||||
}
|
||||
it("Does not mark a nullable field as required") {
|
||||
TestHelpers.openApiTestAllSerializers("T0026__nullable_field.json") { nullableField() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,29 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.nestedUnderRoot
|
||||
import io.bkbn.kompendium.core.util.paramWrapper
|
||||
import io.bkbn.kompendium.core.util.rootRoute
|
||||
import io.bkbn.kompendium.core.util.simplePathParsing
|
||||
import io.bkbn.kompendium.core.util.trailingSlash
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
|
||||
class KompendiumRouteParsingTest : DescribeSpec({
|
||||
describe("Route Parsing") {
|
||||
it("Can parse a simple path and store it under the expected route") {
|
||||
TestHelpers.openApiTestAllSerializers("T0012__path_parser.json") { simplePathParsing() }
|
||||
}
|
||||
it("Can notarize the root route") {
|
||||
TestHelpers.openApiTestAllSerializers("T0013__root_route.json") { rootRoute() }
|
||||
}
|
||||
it("Can notarize a route under the root module without appending trailing slash") {
|
||||
TestHelpers.openApiTestAllSerializers("T0014__nested_under_root.json") { nestedUnderRoot() }
|
||||
}
|
||||
it("Can notarize a route with a trailing slash") {
|
||||
TestHelpers.openApiTestAllSerializers("T0015__trailing_slash.json") { trailingSlash() }
|
||||
}
|
||||
it("Can notarize a route with a parameter") {
|
||||
TestHelpers.openApiTestAllSerializers("T0068__param_wrapper.json") { paramWrapper() }
|
||||
}
|
||||
}
|
||||
})
|
229
core/src/test/kotlin/io/bkbn/kompendium/core/KompendiumTest.kt
Normal file
229
core/src/test/kotlin/io/bkbn/kompendium/core/KompendiumTest.kt
Normal file
@ -0,0 +1,229 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers.openApiTestAllSerializers
|
||||
import io.bkbn.kompendium.core.util.complexRequest
|
||||
import io.bkbn.kompendium.core.util.customFieldNameResponse
|
||||
import io.bkbn.kompendium.core.util.defaultField
|
||||
import io.bkbn.kompendium.core.util.fieldOutsideConstructor
|
||||
import io.bkbn.kompendium.core.util.headerParameter
|
||||
import io.bkbn.kompendium.core.util.ignoredFieldsResponse
|
||||
import io.bkbn.kompendium.core.util.nestedTypeName
|
||||
import io.bkbn.kompendium.core.util.nonRequiredParam
|
||||
import io.bkbn.kompendium.core.util.nonRequiredParams
|
||||
import io.bkbn.kompendium.core.util.notarizedDelete
|
||||
import io.bkbn.kompendium.core.util.notarizedGet
|
||||
import io.bkbn.kompendium.core.util.notarizedHead
|
||||
import io.bkbn.kompendium.core.util.notarizedOptions
|
||||
import io.bkbn.kompendium.core.util.notarizedPatch
|
||||
import io.bkbn.kompendium.core.util.notarizedPost
|
||||
import io.bkbn.kompendium.core.util.notarizedPut
|
||||
import io.bkbn.kompendium.core.util.nullableEnumField
|
||||
import io.bkbn.kompendium.core.util.nullableField
|
||||
import io.bkbn.kompendium.core.util.nullableNestedObject
|
||||
import io.bkbn.kompendium.core.util.nullableReference
|
||||
import io.bkbn.kompendium.core.util.overrideMediaTypes
|
||||
import io.bkbn.kompendium.core.util.postNoReqBody
|
||||
import io.bkbn.kompendium.core.util.primitives
|
||||
import io.bkbn.kompendium.core.util.requiredParams
|
||||
import io.bkbn.kompendium.core.util.responseHeaders
|
||||
import io.bkbn.kompendium.core.util.returnsEnumList
|
||||
import io.bkbn.kompendium.core.util.returnsList
|
||||
import io.bkbn.kompendium.core.util.samePathDifferentMethodsAndAuth
|
||||
import io.bkbn.kompendium.core.util.simpleRecursive
|
||||
import io.bkbn.kompendium.core.util.topLevelNullable
|
||||
import io.bkbn.kompendium.core.util.unbackedFieldsResponse
|
||||
import io.bkbn.kompendium.core.util.withOperationId
|
||||
import io.bkbn.kompendium.oas.component.Components
|
||||
import io.bkbn.kompendium.oas.security.BasicAuth
|
||||
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.auth.Authentication
|
||||
import io.ktor.server.auth.UserIdPrincipal
|
||||
import io.ktor.server.auth.basic
|
||||
import io.ktor.server.response.respondText
|
||||
import io.ktor.server.routing.get
|
||||
import io.ktor.server.routing.route
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import java.net.URI
|
||||
|
||||
class KompendiumTest : DescribeSpec({
|
||||
describe("Notarized Open API Metadata Tests") {
|
||||
it("Can notarize a get request") {
|
||||
openApiTestAllSerializers("T0001__notarized_get.json") { notarizedGet() }
|
||||
}
|
||||
it("Can notarize a post request") {
|
||||
openApiTestAllSerializers("T0002__notarized_post.json") { notarizedPost() }
|
||||
}
|
||||
it("Can notarize a put request") {
|
||||
openApiTestAllSerializers("T0003__notarized_put.json") { notarizedPut() }
|
||||
}
|
||||
it("Can notarize a delete request") {
|
||||
openApiTestAllSerializers("T0004__notarized_delete.json") { notarizedDelete() }
|
||||
}
|
||||
it("Can notarize a patch request") {
|
||||
openApiTestAllSerializers("T0005__notarized_patch.json") { notarizedPatch() }
|
||||
}
|
||||
it("Can notarize a head request") {
|
||||
openApiTestAllSerializers("T0006__notarized_head.json") { notarizedHead() }
|
||||
}
|
||||
it("Can notarize an options request") {
|
||||
openApiTestAllSerializers("T0007__notarized_options.json") { notarizedOptions() }
|
||||
}
|
||||
it("Can notarize a complex type") {
|
||||
openApiTestAllSerializers("T0008__complex_type.json") { complexRequest() }
|
||||
}
|
||||
it("Can notarize primitives") {
|
||||
openApiTestAllSerializers("T0009__notarized_primitives.json") { primitives() }
|
||||
}
|
||||
it("Can notarize a top level list response") {
|
||||
openApiTestAllSerializers("T0010__response_list.json") { returnsList() }
|
||||
}
|
||||
it("Can notarize a route with non-required params") {
|
||||
openApiTestAllSerializers("T0011__non_required_params.json") { nonRequiredParams() }
|
||||
}
|
||||
it("Can override media types") {
|
||||
openApiTestAllSerializers("T0052__override_media_types.json") { overrideMediaTypes() }
|
||||
}
|
||||
it("Can support a post request with no request body") {
|
||||
openApiTestAllSerializers("T0065__post_no_req_body.json") { postNoReqBody() }
|
||||
}
|
||||
it("Can notarize a route with response headers") {
|
||||
openApiTestAllSerializers("T0066__notarized_get_with_response_headers.json") { responseHeaders() }
|
||||
}
|
||||
}
|
||||
describe("Required Fields") {
|
||||
it("Marks a parameter as required if there is no default and it is not marked nullable") {
|
||||
openApiTestAllSerializers("T0023__required_param.json") { requiredParams() }
|
||||
}
|
||||
it("Can mark a parameter as not required") {
|
||||
openApiTestAllSerializers("T0024__non_required_param.json") { nonRequiredParam() }
|
||||
}
|
||||
it("Does not mark a field as required if a default value is provided") {
|
||||
openApiTestAllSerializers("T0025__default_field.json") { defaultField() }
|
||||
}
|
||||
it("Does not mark a nullable field as required") {
|
||||
openApiTestAllSerializers("T0026__nullable_field.json") { nullableField() }
|
||||
}
|
||||
}
|
||||
describe("Custom Serializable Reader tests") {
|
||||
it("Can support ignoring fields") {
|
||||
openApiTestAllSerializers("T0048__ignored_property.json") { ignoredFieldsResponse() }
|
||||
}
|
||||
it("Can support un-backed fields") {
|
||||
openApiTestAllSerializers("T0049__unbacked_property.json") { unbackedFieldsResponse() }
|
||||
}
|
||||
it("Can support custom named fields") {
|
||||
openApiTestAllSerializers("T0050__custom_named_property.json") { customFieldNameResponse() }
|
||||
}
|
||||
}
|
||||
describe("Miscellaneous") {
|
||||
xit("Can generate the necessary ReDoc home page") {
|
||||
// TODO apiFunctionalityTest(getFileSnapshot("redoc.html"), "/docs") { returnsList() }
|
||||
}
|
||||
it("Can add an operation id to a notarized route") {
|
||||
openApiTestAllSerializers("T0034__notarized_get_with_operation_id.json") { withOperationId() }
|
||||
}
|
||||
xit("Can add an undeclared field") {
|
||||
// TODO openApiTestAllSerializers("undeclared_field.json") { undeclaredType() }
|
||||
}
|
||||
it("Can add a custom header parameter with a name override") {
|
||||
openApiTestAllSerializers("T0035__override_parameter_name.json") { headerParameter() }
|
||||
}
|
||||
xit("Can override field name") {
|
||||
// TODO Assess strategies here
|
||||
}
|
||||
it("Can serialize a recursive type") {
|
||||
openApiTestAllSerializers("T0042__simple_recursive.json") { simpleRecursive() }
|
||||
}
|
||||
it("Nullable fields do not lead to doom") {
|
||||
openApiTestAllSerializers("T0036__nullable_fields.json") { nullableNestedObject() }
|
||||
}
|
||||
it("Can have a nullable enum as a member field") {
|
||||
openApiTestAllSerializers("T0037__nullable_enum_field.json") { nullableEnumField() }
|
||||
}
|
||||
it("Can have a list of enums as a field") {
|
||||
openApiTestAllSerializers("T0076__list_of_enums.json") { returnsEnumList() }
|
||||
}
|
||||
it("Can have a nullable reference without impacting base type") {
|
||||
openApiTestAllSerializers("T0041__nullable_reference.json") { nullableReference() }
|
||||
}
|
||||
it("Can handle nested type names") {
|
||||
openApiTestAllSerializers("T0044__nested_type_name.json") { nestedTypeName() }
|
||||
}
|
||||
it("Can handle top level nullable types") {
|
||||
openApiTestAllSerializers("T0051__top_level_nullable.json") { topLevelNullable() }
|
||||
}
|
||||
it("Can handle multiple registrations for different methods with the same path and different auth") {
|
||||
openApiTestAllSerializers(
|
||||
"T0053__same_path_different_methods_and_auth.json",
|
||||
applicationSetup = {
|
||||
install(Authentication) {
|
||||
basic("basic") {
|
||||
realm = "Ktor Server"
|
||||
validate { UserIdPrincipal("Placeholder") }
|
||||
}
|
||||
}
|
||||
},
|
||||
specOverrides = {
|
||||
this.copy(
|
||||
components = Components(
|
||||
securitySchemes = mutableMapOf(
|
||||
"basic" to BasicAuth()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
) { samePathDifferentMethodsAndAuth() }
|
||||
}
|
||||
it("Can generate paths without application root-path") {
|
||||
openApiTestAllSerializers(
|
||||
"T0054__app_with_rootpath.json",
|
||||
applicationSetup = {
|
||||
rootPath = "/example"
|
||||
},
|
||||
specOverrides = {
|
||||
copy(
|
||||
servers = servers.map { it.copy(url = URI("${it.url}/example")) }.toMutableList()
|
||||
)
|
||||
},
|
||||
serverConfigSetup = {
|
||||
rootPath = "/example"
|
||||
}
|
||||
) { notarizedGet() }
|
||||
}
|
||||
it("Can apply a custom serialization strategy to the openapi document") {
|
||||
val customJsonEncoder = Json {
|
||||
serializersModule = KompendiumSerializersModule.module
|
||||
encodeDefaults = true
|
||||
explicitNulls = false
|
||||
}
|
||||
openApiTestAllSerializers(
|
||||
snapshotName = "T0072__custom_serialization_strategy.json",
|
||||
notarizedApplicationConfigOverrides = {
|
||||
specRoute = { spec, routing ->
|
||||
routing.route("/openapi.json") {
|
||||
get {
|
||||
call.response.headers.append("Content-Type", "application/json")
|
||||
call.respondText { customJsonEncoder.encodeToString(spec) }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
contentNegotiation = {
|
||||
json(
|
||||
Json {
|
||||
encodeDefaults = true
|
||||
explicitNulls = true
|
||||
}
|
||||
)
|
||||
}
|
||||
) { notarizedGet() }
|
||||
}
|
||||
it("Can serialize a data class with a field outside of the constructor") {
|
||||
openApiTestAllSerializers("T0073__data_class_with_field_outside_constructor.json") { fieldOutsideConstructor() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,19 @@
|
||||
package io.bkbn.kompendium.core
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestHelpers
|
||||
import io.bkbn.kompendium.core.util.dateTimeString
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import java.time.Instant
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
class KompendiumTypeFormatTest : DescribeSpec({
|
||||
describe("Formats") {
|
||||
it("Can set a format for a simple type schema") {
|
||||
TestHelpers.openApiTestAllSerializers(
|
||||
snapshotName = "T0038__formatted_date_time_string.json",
|
||||
customTypes = mapOf(typeOf<Instant>() to TypeDefinition(type = "string", format = "date"))
|
||||
) { dateTimeString() }
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,88 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathSummary
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultResponseDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.rootPath
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.auth.authenticate
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.defaultAuthConfig() {
|
||||
authenticate("basic") {
|
||||
route(rootPath) {
|
||||
basicGetGenerator<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.customAuthConfig() {
|
||||
authenticate("auth-oauth-google") {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
security = mapOf(
|
||||
"auth-oauth-google" to listOf("read:pets")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.customScopesOnSiblingPathOperations() {
|
||||
authenticate("auth-oauth-google") {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
security = mapOf(
|
||||
"auth-oauth-google" to listOf("read:pets")
|
||||
)
|
||||
}
|
||||
post = PostInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
request {
|
||||
description(defaultResponseDescription)
|
||||
requestType<TestResponse>()
|
||||
}
|
||||
security = mapOf(
|
||||
"auth-oauth-google" to listOf("write:pets")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.multipleAuthStrategies() {
|
||||
authenticate("jwt", "api-key") {
|
||||
route(rootPath) {
|
||||
basicGetGenerator<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
174
core/src/test/kotlin/io/bkbn/kompendium/core/util/Constraints.kt
Normal file
174
core/src/test/kotlin/io/bkbn/kompendium/core/util/Constraints.kt
Normal file
@ -0,0 +1,174 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.DoubleResponse
|
||||
import io.bkbn.kompendium.core.fixtures.Page
|
||||
import io.bkbn.kompendium.core.fixtures.TestCreatedResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestNested
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPath
|
||||
import io.bkbn.kompendium.enrichment.CollectionEnrichment
|
||||
import io.bkbn.kompendium.enrichment.NumberEnrichment
|
||||
import io.bkbn.kompendium.enrichment.ObjectEnrichment
|
||||
import io.bkbn.kompendium.enrichment.StringEnrichment
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.intConstraints() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary("Get an int")
|
||||
description("Get an int")
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
description("An int")
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("example") {
|
||||
TestCreatedResponse::id {
|
||||
NumberEnrichment("blah-blah-blah") {
|
||||
minimum = 2
|
||||
maximum = 100
|
||||
multipleOf = 2
|
||||
}
|
||||
}
|
||||
responseCode(HttpStatusCode.OK)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.doubleConstraints() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary("Get a double")
|
||||
description("Get a double")
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
description("A double")
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("example") {
|
||||
DoubleResponse::payload {
|
||||
NumberEnrichment("blah-blah-blah") {
|
||||
minimum = 2.0
|
||||
maximum = 100.0
|
||||
multipleOf = 2.0
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.stringConstraints() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary("Get a string")
|
||||
description("Get a string with constraints")
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
description("A string")
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("example") {
|
||||
TestNested::nesty {
|
||||
StringEnrichment("blah") {
|
||||
maxLength = 10
|
||||
minLength = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.stringPatternConstraints() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary("Get a string")
|
||||
description("This is a description")
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
description("A string")
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("example") {
|
||||
TestNested::nesty {
|
||||
StringEnrichment("blah") {
|
||||
pattern = "[a-z]+"
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.stringContentEncodingConstraints() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary("Get a string")
|
||||
description("This is a description")
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
description("A string")
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("example") {
|
||||
TestNested::nesty {
|
||||
StringEnrichment("blah") {
|
||||
contentEncoding = "base64"
|
||||
contentMediaType = "image/png"
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.arrayConstraints() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary("Get an array")
|
||||
description("Get an array of strings")
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
description("An array")
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("example") {
|
||||
Page<String>::content {
|
||||
CollectionEnrichment<String>("blah") {
|
||||
minItems = 2
|
||||
maxItems = 10
|
||||
uniqueItems = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.SerialNameObject
|
||||
import io.bkbn.kompendium.core.fixtures.TransientObject
|
||||
import io.bkbn.kompendium.core.fixtures.UnbackedObject
|
||||
import io.ktor.server.routing.Route
|
||||
|
||||
fun Route.ignoredFieldsResponse() = basicGetGenerator<TransientObject>()
|
||||
fun Route.unbackedFieldsResponse() = basicGetGenerator<UnbackedObject>()
|
||||
fun Route.customFieldNameResponse() = basicGetGenerator<SerialNameObject>()
|
@ -0,0 +1,16 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.server.routing.Route
|
||||
|
||||
fun Route.defaultParameter() = basicGetGenerator<TestResponse>(
|
||||
params = listOf(
|
||||
Parameter(
|
||||
name = "id",
|
||||
`in` = Parameter.Location.path,
|
||||
schema = TypeDefinition.STRING.withDefault("IDK")
|
||||
)
|
||||
)
|
||||
)
|
264
core/src/test/kotlin/io/bkbn/kompendium/core/util/Enrichment.kt
Normal file
264
core/src/test/kotlin/io/bkbn/kompendium/core/util/Enrichment.kt
Normal file
@ -0,0 +1,264 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.ComplexRequest
|
||||
import io.bkbn.kompendium.core.fixtures.GenericObject
|
||||
import io.bkbn.kompendium.core.fixtures.MultiNestedGenerics
|
||||
import io.bkbn.kompendium.core.fixtures.NestedComplexItem
|
||||
import io.bkbn.kompendium.core.fixtures.TestCreatedResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestSimpleRequest
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.enrichment.BooleanEnrichment
|
||||
import io.bkbn.kompendium.enrichment.CollectionEnrichment
|
||||
import io.bkbn.kompendium.enrichment.MapEnrichment
|
||||
import io.bkbn.kompendium.enrichment.NumberEnrichment
|
||||
import io.bkbn.kompendium.enrichment.ObjectEnrichment
|
||||
import io.bkbn.kompendium.enrichment.StringEnrichment
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.enrichedSimpleResponse() {
|
||||
route("/enriched") {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(TestModules.defaultPathSummary)
|
||||
description(TestModules.defaultPathDescription)
|
||||
response {
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("simple") {
|
||||
TestResponse::c {
|
||||
StringEnrichment("blah-blah-blah") {
|
||||
description = "A simple description"
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
description("A good response")
|
||||
responseCode(HttpStatusCode.Created)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.enrichedSimpleRequest() {
|
||||
route("/example") {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = TestModules.defaultParams
|
||||
post = PostInfo.builder {
|
||||
summary(TestModules.defaultPathSummary)
|
||||
description(TestModules.defaultPathDescription)
|
||||
request {
|
||||
requestType(
|
||||
enrichment = ObjectEnrichment("simple") {
|
||||
TestSimpleRequest::a {
|
||||
StringEnrichment("blah-blah-blah") {
|
||||
description = "A simple description"
|
||||
}
|
||||
}
|
||||
TestSimpleRequest::b {
|
||||
NumberEnrichment("blah-blah-blah") {
|
||||
deprecated = true
|
||||
}
|
||||
}
|
||||
TestSimpleRequest::c {
|
||||
BooleanEnrichment("blah-blah-blah") { }
|
||||
}
|
||||
}
|
||||
)
|
||||
description("A test request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(TestModules.defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.enrichedNestedCollection() {
|
||||
route("/example") {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = TestModules.defaultParams
|
||||
post = PostInfo.builder {
|
||||
summary(TestModules.defaultPathSummary)
|
||||
description(TestModules.defaultPathDescription)
|
||||
request {
|
||||
requestType(
|
||||
enrichment = ObjectEnrichment("simple") {
|
||||
ComplexRequest::tables {
|
||||
CollectionEnrichment<NestedComplexItem>("blah-blah") {
|
||||
description = "A nested description"
|
||||
itemEnrichment = ObjectEnrichment("nested") {
|
||||
NestedComplexItem::name {
|
||||
StringEnrichment("beleheh") {
|
||||
description = "A nested description"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
description("A test request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(TestModules.defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.enrichedTopLevelCollection() {
|
||||
route("/example") {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = TestModules.defaultParams
|
||||
post = PostInfo.builder {
|
||||
summary(TestModules.defaultPathSummary)
|
||||
description(TestModules.defaultPathDescription)
|
||||
request {
|
||||
requestType(
|
||||
enrichment = CollectionEnrichment<List<TestSimpleRequest>>("blah-blah") {
|
||||
itemEnrichment = ObjectEnrichment("simple") {
|
||||
TestSimpleRequest::a {
|
||||
StringEnrichment("blah-blah-blah") {
|
||||
description = "A simple description"
|
||||
}
|
||||
}
|
||||
TestSimpleRequest::b {
|
||||
NumberEnrichment("blah-blah-blah") {
|
||||
deprecated = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
description("A test request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(TestModules.defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.enrichedComplexGenericType() {
|
||||
route("/example") {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = TestModules.defaultParams
|
||||
post = PostInfo.builder {
|
||||
summary(TestModules.defaultPathSummary)
|
||||
description(TestModules.defaultPathDescription)
|
||||
request {
|
||||
requestType(
|
||||
enrichment = ObjectEnrichment("simple") {
|
||||
MultiNestedGenerics<String, ComplexRequest>::content {
|
||||
MapEnrichment<ComplexRequest>("blah") {
|
||||
description = "A nested description"
|
||||
valueEnrichment = ObjectEnrichment("nested") {
|
||||
ComplexRequest::tables {
|
||||
CollectionEnrichment<NestedComplexItem>("blah-blah") {
|
||||
description = "A nested description"
|
||||
itemEnrichment = ObjectEnrichment("nested") {
|
||||
NestedComplexItem::name {
|
||||
StringEnrichment("beleheh") {
|
||||
description = "A nested description"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
description("A test request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(TestModules.defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.enrichedGenericResponse() {
|
||||
route("/example") {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(TestModules.defaultPathSummary)
|
||||
description(TestModules.defaultPathDescription)
|
||||
response {
|
||||
responseType(
|
||||
enrichment = ObjectEnrichment("generic") {
|
||||
description = "another description"
|
||||
GenericObject<TestSimpleRequest>::data {
|
||||
ObjectEnrichment("simple") {
|
||||
description = "also a description"
|
||||
TestSimpleRequest::a {
|
||||
StringEnrichment("blah-blah-blah") {
|
||||
description = "A simple description"
|
||||
}
|
||||
}
|
||||
TestSimpleRequest::b {
|
||||
NumberEnrichment("blah-blah-blah") {
|
||||
deprecated = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
description("A good response")
|
||||
responseCode(HttpStatusCode.Created)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.enrichedMap() {
|
||||
route("/example") {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(TestModules.defaultPathSummary)
|
||||
description(TestModules.defaultPathDescription)
|
||||
response {
|
||||
responseType<Map<String, TestSimpleRequest>>(
|
||||
enrichment = MapEnrichment("blah") {
|
||||
description = "A nested description"
|
||||
valueEnrichment = ObjectEnrichment("nested") {
|
||||
TestSimpleRequest::a {
|
||||
StringEnrichment("blah-blah-blah") {
|
||||
description = "A simple description"
|
||||
}
|
||||
}
|
||||
TestSimpleRequest::b {
|
||||
NumberEnrichment("blah-blah-blah") {
|
||||
deprecated = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
description("A good response")
|
||||
responseCode(HttpStatusCode.Created)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPath
|
||||
import io.ktor.server.auth.authenticate
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.samePathSameMethod() {
|
||||
route(defaultPath) {
|
||||
basicGetGenerator<TestResponse>()
|
||||
authenticate("basic") {
|
||||
basicGetGenerator<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
114
core/src/test/kotlin/io/bkbn/kompendium/core/util/Examples.kt
Normal file
114
core/src/test/kotlin/io/bkbn/kompendium/core/util/Examples.kt
Normal file
@ -0,0 +1,114 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestNested
|
||||
import io.bkbn.kompendium.core.fixtures.TestRequest
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathSummary
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultRequestDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultResponseDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.rootPath
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.oas.payload.MediaType
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.reqRespExamples() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
post = PostInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
description(defaultRequestDescription)
|
||||
requestType<TestRequest>()
|
||||
examples(
|
||||
"Testerina" to MediaType.Example(TestRequest(TestNested("asdf"), 1.5, emptyList()))
|
||||
)
|
||||
}
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
examples(
|
||||
"Testerino" to MediaType.Example(TestResponse("Heya"))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.exampleParams() = basicGetGenerator<TestResponse>(
|
||||
params = listOf(
|
||||
Parameter(
|
||||
name = "id",
|
||||
`in` = Parameter.Location.path,
|
||||
schema = TypeDefinition.STRING,
|
||||
examples = mapOf(
|
||||
"foo" to MediaType.Example("testing")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
fun Route.optionalReqExample() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
post = PostInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
description(defaultRequestDescription)
|
||||
requestType<TestRequest>()
|
||||
examples(
|
||||
"Testerina" to MediaType.Example(TestRequest(TestNested("asdf"), 1.5, emptyList()))
|
||||
)
|
||||
required(false)
|
||||
}
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
examples(
|
||||
"Testerino" to MediaType.Example(TestResponse("Heya"))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.exampleSummaryAndDescription() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
post = PostInfo.builder {
|
||||
summary("This is a summary")
|
||||
description("This is a description")
|
||||
request {
|
||||
description("This is a request description")
|
||||
requestType<TestRequest>()
|
||||
examples(
|
||||
"Testerina" to MediaType.Example(
|
||||
TestRequest(TestNested("asdf"), 1.5, emptyList()),
|
||||
"summary",
|
||||
"description"
|
||||
)
|
||||
)
|
||||
}
|
||||
response {
|
||||
description("This is a response description")
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
examples(
|
||||
"Testerino" to MediaType.Example(TestResponse("Heya"), "summary", "description")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
core/src/test/kotlin/io/bkbn/kompendium/core/util/Exceptions.kt
Normal file
104
core/src/test/kotlin/io/bkbn/kompendium/core/util/Exceptions.kt
Normal file
@ -0,0 +1,104 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.ExceptionResponse
|
||||
import io.bkbn.kompendium.core.fixtures.Flibbity
|
||||
import io.bkbn.kompendium.core.fixtures.FlibbityGibbit
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathSummary
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultResponseDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.rootPath
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.singleException() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
canRespond {
|
||||
description("Bad Things Happened")
|
||||
responseCode(HttpStatusCode.BadRequest)
|
||||
responseType<ExceptionResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.multipleExceptions() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
canRespond {
|
||||
description("Bad Things Happened")
|
||||
responseCode(HttpStatusCode.BadRequest)
|
||||
responseType<ExceptionResponse>()
|
||||
}
|
||||
canRespond {
|
||||
description("Access Denied")
|
||||
responseCode(HttpStatusCode.Forbidden)
|
||||
responseType<ExceptionResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.polymorphicException() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
canRespond {
|
||||
description("Bad Things Happened")
|
||||
responseCode(HttpStatusCode.InternalServerError)
|
||||
responseType<FlibbityGibbit>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.genericException() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
canRespond {
|
||||
description("Bad Things Happened")
|
||||
responseCode(HttpStatusCode.BadRequest)
|
||||
responseType<Flibbity<String>>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.ColumnSchema
|
||||
import io.bkbn.kompendium.core.fixtures.DateTimeString
|
||||
import io.bkbn.kompendium.core.fixtures.ManyThings
|
||||
import io.bkbn.kompendium.core.fixtures.Nested
|
||||
import io.bkbn.kompendium.core.fixtures.NullableEnum
|
||||
import io.bkbn.kompendium.core.fixtures.ProfileUpdateRequest
|
||||
import io.bkbn.kompendium.core.fixtures.TestCreatedResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestSimpleRequest
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultParams
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPath
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathSummary
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultRequestDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultResponseDescription
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.auth.authenticate
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.withOperationId() = basicGetGenerator<TestResponse>(operationId = "getThisDude")
|
||||
fun Route.nullableNestedObject() = basicGetGenerator<ProfileUpdateRequest>()
|
||||
fun Route.nullableEnumField() = basicGetGenerator<NullableEnum>()
|
||||
fun Route.nullableReference() = basicGetGenerator<ManyThings>()
|
||||
fun Route.dateTimeString() = basicGetGenerator<DateTimeString>()
|
||||
fun Route.headerParameter() = basicGetGenerator<TestResponse>(
|
||||
params = listOf(
|
||||
Parameter(
|
||||
name = "X-User-Email",
|
||||
`in` = Parameter.Location.header,
|
||||
schema = TypeDefinition.STRING,
|
||||
required = true
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
fun Route.nestedTypeName() = basicGetGenerator<Nested.Response>()
|
||||
fun Route.topLevelNullable() = basicGetGenerator<TestResponse?>()
|
||||
fun Route.simpleRecursive() = basicGetGenerator<ColumnSchema>()
|
||||
fun Route.samePathDifferentMethodsAndAuth() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
authenticate("basic") {
|
||||
install(NotarizedRoute()) {
|
||||
put = PutInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
description(defaultRequestDescription)
|
||||
requestType<TestSimpleRequest>()
|
||||
}
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,388 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.ComplexRequest
|
||||
import io.bkbn.kompendium.core.fixtures.SomethingSimilar
|
||||
import io.bkbn.kompendium.core.fixtures.TestCreatedResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestEnum
|
||||
import io.bkbn.kompendium.core.fixtures.TestRequest
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.fixtures.TestSimpleRequest
|
||||
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultParams
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPath
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathSummary
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultResponseDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.rootPath
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.oas.payload.Header
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.http.HttpHeaders
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.response.respondText
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.delete
|
||||
import io.ktor.server.routing.get
|
||||
import io.ktor.server.routing.head
|
||||
import io.ktor.server.routing.options
|
||||
import io.ktor.server.routing.patch
|
||||
import io.ktor.server.routing.post
|
||||
import io.ktor.server.routing.put
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
fun Route.notarizedGet() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
get = GetInfo.builder {
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
description(defaultResponseDescription)
|
||||
}
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
}
|
||||
}
|
||||
get {
|
||||
call.respondText { "hey dude ‼️ congrats on the get request" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.responseHeaders() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
get = GetInfo.builder {
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
description(defaultResponseDescription)
|
||||
responseHeaders(
|
||||
mapOf(
|
||||
HttpHeaders.ETag to Header(
|
||||
TypeDefinition.STRING,
|
||||
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag"
|
||||
),
|
||||
HttpHeaders.LastModified to Header(
|
||||
TypeDefinition.STRING,
|
||||
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified"
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
}
|
||||
}
|
||||
get {
|
||||
call.respondText { "hey dude ‼️ congrats on the get request" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.notarizedPost() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
post = PostInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
requestType<TestSimpleRequest>()
|
||||
description("A Test request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
call.respondText { "hey dude ‼️ congrats on the post request" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.notarizedPut() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
put = PutInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
requestType<TestSimpleRequest>()
|
||||
description("A Test request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
put {
|
||||
call.respondText { "hey dude ‼️ congrats on the post request" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.notarizedDelete() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
delete = DeleteInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
responseCode(HttpStatusCode.NoContent)
|
||||
responseType<Unit>()
|
||||
description(defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete {
|
||||
call.respond(HttpStatusCode.NoContent)
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.notarizedPatch() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
patch = PatchInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
description("A Test request")
|
||||
requestType<TestSimpleRequest>()
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
patch {
|
||||
call.respond(HttpStatusCode.Created) { TestCreatedResponse(123, "Nice!") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.notarizedHead() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
head = HeadInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
|
||||
response {
|
||||
description("great!")
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<Unit>()
|
||||
}
|
||||
}
|
||||
}
|
||||
head {
|
||||
call.respond(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.notarizedOptions() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
options = OptionsInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
description("nice")
|
||||
}
|
||||
}
|
||||
}
|
||||
options {
|
||||
call.respond(HttpStatusCode.NoContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.complexRequest() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
put = PutInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
requestType<ComplexRequest>()
|
||||
description("A Complex request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<TestCreatedResponse>()
|
||||
description(defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
patch {
|
||||
call.respond(HttpStatusCode.Created, TestCreatedResponse(123, "nice!"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.primitives() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
put = PutInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
requestType<Int>()
|
||||
description("A Test Request")
|
||||
}
|
||||
response {
|
||||
responseCode(HttpStatusCode.Created)
|
||||
responseType<Boolean>()
|
||||
description(defaultResponseDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.returnsList() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description("A Successful List-y Endeavor")
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<List<TestResponse>>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.returnsEnumList() {
|
||||
route(defaultPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = defaultParams
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description("A Successful List-y Endeavor")
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<List<TestEnum>>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.nonRequiredParams() {
|
||||
route("/optional") {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = listOf(
|
||||
Parameter(
|
||||
name = "notRequired",
|
||||
`in` = Parameter.Location.query,
|
||||
schema = TypeDefinition.STRING,
|
||||
required = false,
|
||||
),
|
||||
Parameter(
|
||||
name = "required",
|
||||
`in` = Parameter.Location.query,
|
||||
schema = TypeDefinition.STRING
|
||||
)
|
||||
)
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
responseType<Unit>()
|
||||
description("Empty")
|
||||
responseCode(HttpStatusCode.NoContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.overrideMediaTypes() {
|
||||
route("/media_types") {
|
||||
install(NotarizedRoute()) {
|
||||
put = PutInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
mediaTypes("multipart/form-data", "application/json")
|
||||
requestType<TestRequest>()
|
||||
description("A cool request")
|
||||
}
|
||||
response {
|
||||
mediaTypes("application/xml")
|
||||
responseType<TestResponse>()
|
||||
description("A good response")
|
||||
responseCode(HttpStatusCode.Created)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.postNoReqBody() {
|
||||
route("/no_req_body") {
|
||||
install(NotarizedRoute()) {
|
||||
post = PostInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
responseType<TestResponse>()
|
||||
description("Cool response")
|
||||
responseCode(HttpStatusCode.Created)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.fieldOutsideConstructor() {
|
||||
route("/field_outside_constructor") {
|
||||
install(NotarizedRoute()) {
|
||||
post = PostInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
request {
|
||||
requestType<SomethingSimilar>()
|
||||
description("A cool request")
|
||||
}
|
||||
response {
|
||||
responseType<TestResponse>()
|
||||
description("Cool response")
|
||||
responseCode(HttpStatusCode.Created)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.Barzo
|
||||
import io.bkbn.kompendium.core.fixtures.ChillaxificationMaximization
|
||||
import io.bkbn.kompendium.core.fixtures.ComplexRequest
|
||||
import io.bkbn.kompendium.core.fixtures.Flibbity
|
||||
import io.bkbn.kompendium.core.fixtures.FlibbityGibbit
|
||||
import io.bkbn.kompendium.core.fixtures.Foosy
|
||||
import io.bkbn.kompendium.core.fixtures.Gibbity
|
||||
import io.bkbn.kompendium.core.fixtures.Gizmo
|
||||
import io.bkbn.kompendium.core.fixtures.MultiNestedGenerics
|
||||
import io.bkbn.kompendium.core.fixtures.Page
|
||||
import io.ktor.server.routing.Route
|
||||
|
||||
fun Route.polymorphicResponse() = basicGetGenerator<FlibbityGibbit>()
|
||||
fun Route.polymorphicCollectionResponse() = basicGetGenerator<List<FlibbityGibbit>>()
|
||||
fun Route.polymorphicMapResponse() = basicGetGenerator<Map<String, FlibbityGibbit>>()
|
||||
fun Route.simpleGenericResponse() = basicGetGenerator<Gibbity<String>>()
|
||||
fun Route.gnarlyGenericResponse() = basicGetGenerator<Foosy<Barzo<Int>, String>>()
|
||||
fun Route.nestedGenericResponse() = basicGetGenerator<Gibbity<Map<String, String>>>()
|
||||
fun Route.genericPolymorphicResponse() = basicGetGenerator<Flibbity<Double>>()
|
||||
fun Route.genericPolymorphicResponseMultipleImpls() = basicGetGenerator<Flibbity<FlibbityGibbit>>()
|
||||
fun Route.nestedGenericCollection() = basicGetGenerator<Page<Int>>()
|
||||
fun Route.nestedGenericMultipleParamsCollection() = basicGetGenerator<MultiNestedGenerics<String, ComplexRequest>>()
|
||||
fun Route.overrideSealedTypeIdentifier() = basicGetGenerator<ChillaxificationMaximization>()
|
||||
fun Route.subtypeNotCompleteSetOfParentProperties() = basicGetGenerator<Gizmo>()
|
@ -0,0 +1,32 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.DefaultField
|
||||
import io.bkbn.kompendium.core.fixtures.NullableField
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.server.routing.Route
|
||||
|
||||
fun Route.requiredParams() = basicGetGenerator<TestResponse>(
|
||||
params = listOf(
|
||||
Parameter(
|
||||
name = "id",
|
||||
`in` = Parameter.Location.path,
|
||||
schema = TypeDefinition.STRING
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
fun Route.nonRequiredParam() = basicGetGenerator<TestResponse>(
|
||||
params = listOf(
|
||||
Parameter(
|
||||
name = "id",
|
||||
`in` = Parameter.Location.query,
|
||||
schema = TypeDefinition.STRING,
|
||||
required = false
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
fun Route.defaultField() = basicGetGenerator<DefaultField>()
|
||||
fun Route.nullableField() = basicGetGenerator<NullableField>()
|
@ -0,0 +1,131 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultParams
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathSummary
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultResponseDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.rootPath
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.route
|
||||
import io.ktor.server.routing.param
|
||||
|
||||
fun Route.simplePathParsing() {
|
||||
route("/this") {
|
||||
route("/is") {
|
||||
route("/a") {
|
||||
route("/complex") {
|
||||
route("path") {
|
||||
route("with/an/{id}") {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
parameters = listOf(
|
||||
Parameter(
|
||||
name = "id",
|
||||
`in` = Parameter.Location.path,
|
||||
schema = TypeDefinition.STRING
|
||||
)
|
||||
)
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.rootRoute() {
|
||||
route(rootPath) {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = listOf(defaultParams.last())
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.nestedUnderRoot() {
|
||||
route("/") {
|
||||
route("/testerino") {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.trailingSlash() {
|
||||
route("/test") {
|
||||
route("/") {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Route.paramWrapper() {
|
||||
route("/test") {
|
||||
param("a") {
|
||||
param("b") {
|
||||
param("c") {
|
||||
install(NotarizedRoute()) {
|
||||
parameters = listOf(
|
||||
Parameter(
|
||||
name = "test",
|
||||
`in` = Parameter.Location.query,
|
||||
schema = TypeDefinition.STRING
|
||||
)
|
||||
)
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<TestResponse>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package io.bkbn.kompendium.core.util
|
||||
|
||||
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultPathSummary
|
||||
import io.bkbn.kompendium.core.util.TestModules.defaultResponseDescription
|
||||
import io.bkbn.kompendium.core.util.TestModules.rootPath
|
||||
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||
import io.bkbn.kompendium.oas.payload.Parameter
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.Routing
|
||||
import io.ktor.server.routing.route
|
||||
|
||||
object TestModules {
|
||||
|
||||
const val defaultPath = "/test/{a}"
|
||||
const val rootPath = "/"
|
||||
const val defaultResponseDescription = "A Successful Endeavor"
|
||||
const val defaultRequestDescription = "You gotta send it"
|
||||
const val defaultPathSummary = "Great Summary!"
|
||||
const val defaultPathDescription = "testing more"
|
||||
|
||||
val defaultParams = listOf(
|
||||
Parameter(
|
||||
name = "a",
|
||||
`in` = Parameter.Location.path,
|
||||
schema = TypeDefinition.STRING,
|
||||
),
|
||||
Parameter(
|
||||
name = "aa",
|
||||
`in` = Parameter.Location.query,
|
||||
schema = TypeDefinition.INT
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
internal inline fun <reified T> Routing.basicGetGenerator(
|
||||
params: List<Parameter> = emptyList(),
|
||||
operationId: String? = null
|
||||
) {
|
||||
route(rootPath) {
|
||||
basicGetGenerator<T>(params, operationId)
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun <reified T> Route.basicGetGenerator(
|
||||
params: List<Parameter> = emptyList(),
|
||||
operationId: String? = null
|
||||
) {
|
||||
install(NotarizedRoute()) {
|
||||
get = GetInfo.builder {
|
||||
summary(defaultPathSummary)
|
||||
description(defaultPathDescription)
|
||||
operationId?.let { operationId(it) }
|
||||
parameters = params
|
||||
response {
|
||||
description(defaultResponseDescription)
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<T>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
92
core/src/test/resources/T0001__notarized_get.json
Normal file
92
core/src/test/resources/T0001__notarized_get.json
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
128
core/src/test/resources/T0002__notarized_post.json
Normal file
128
core/src/test/resources/T0002__notarized_post.json
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"post": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"description": "A Test request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestSimpleRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestCreatedResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c",
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"TestSimpleRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"b": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"c": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
128
core/src/test/resources/T0003__notarized_put.json
Normal file
128
core/src/test/resources/T0003__notarized_put.json
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"put": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"description": "A Test request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestSimpleRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestCreatedResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c",
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"TestSimpleRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"b": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"c": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
73
core/src/test/resources/T0004__notarized_delete.json
Normal file
73
core/src/test/resources/T0004__notarized_delete.json
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"delete": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "A Successful Endeavor"
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
128
core/src/test/resources/T0005__notarized_patch.json
Normal file
128
core/src/test/resources/T0005__notarized_patch.json
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"patch": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"description": "A Test request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestSimpleRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestCreatedResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c",
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"TestSimpleRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"b": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"c": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
73
core/src/test/resources/T0006__notarized_head.json
Normal file
73
core/src/test/resources/T0006__notarized_head.json
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"head": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "great!"
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
92
core/src/test/resources/T0007__notarized_options.json
Normal file
92
core/src/test/resources/T0007__notarized_options.json
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"options": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "nice",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
145
core/src/test/resources/T0008__complex_type.json
Normal file
145
core/src/test/resources/T0008__complex_type.json
Normal file
@ -0,0 +1,145 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"put": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"description": "A Complex request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ComplexRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestCreatedResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c",
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"ComplexRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amazingField": {
|
||||
"type": "string"
|
||||
},
|
||||
"org": {
|
||||
"type": "string"
|
||||
},
|
||||
"tables": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/NestedComplexItem"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"amazingField",
|
||||
"org",
|
||||
"tables"
|
||||
]
|
||||
},
|
||||
"NestedComplexItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alias": {
|
||||
"additionalProperties": {
|
||||
"$ref": "#/components/schemas/CrazyItem"
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"alias",
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"CrazyItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enumeration": {
|
||||
"$ref": "#/components/schemas/SimpleEnum"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"enumeration"
|
||||
]
|
||||
},
|
||||
"SimpleEnum": {
|
||||
"enum": [
|
||||
"ONE",
|
||||
"TWO"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
79
core/src/test/resources/T0009__notarized_primitives.json
Normal file
79
core/src/test/resources/T0009__notarized_primitives.json
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"put": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"description": "A Test Request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Boolean": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Int": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
98
core/src/test/resources/T0010__response_list.json
Normal file
98
core/src/test/resources/T0010__response_list.json
Normal file
@ -0,0 +1,98 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/{a}": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful List-y Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/List-TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "a",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
},
|
||||
"List-TestResponse": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
72
core/src/test/resources/T0011__non_required_params.json
Normal file
72
core/src/test/resources/T0011__non_required_params.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/optional": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Empty"
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "notRequired",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": false,
|
||||
"deprecated": false
|
||||
},
|
||||
{
|
||||
"name": "required",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
82
core/src/test/resources/T0012__path_parser.json
Normal file
82
core/src/test/resources/T0012__path_parser.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/this/is/a/complex/path/with/an/{id}": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
83
core/src/test/resources/T0013__root_route.json
Normal file
83
core/src/test/resources/T0013__root_route.json
Normal file
@ -0,0 +1,83 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "aa",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
72
core/src/test/resources/T0014__nested_under_root.json
Normal file
72
core/src/test/resources/T0014__nested_under_root.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/testerino": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
72
core/src/test/resources/T0015__trailing_slash.json
Normal file
72
core/src/test/resources/T0015__trailing_slash.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/test/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Things Happened",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ExceptionResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
},
|
||||
"ExceptionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Things Happened",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ExceptionResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Access Denied",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ExceptionResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
},
|
||||
"ExceptionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"message"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Bad Things Happened",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/FlibbityGibbit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
},
|
||||
"ComplexGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"c": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.ComplexGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"c",
|
||||
"z",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"SimpleGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.SimpleGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"FlibbityGibbit": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ComplexGibbit"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SimpleGibbit"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
130
core/src/test/resources/T0019__generic_exception.json
Normal file
130
core/src/test/resources/T0019__generic_exception.json
Normal file
@ -0,0 +1,130 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Things Happened",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Flibbity-String"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
},
|
||||
"Bibbity-String": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"f": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.Bibbity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"f",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"Gibbity-String": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.Gibbity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"Flibbity-String": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Bibbity-String"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/Gibbity-String"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
136
core/src/test/resources/T0020__example_req_and_resp.json
Normal file
136
core/src/test/resources/T0020__example_req_and_resp.json
Normal file
@ -0,0 +1,136 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"post": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"description": "You gotta send it",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestRequest"
|
||||
},
|
||||
"examples": {
|
||||
"Testerina": {
|
||||
"value": {
|
||||
"fieldName": {
|
||||
"nesty": "asdf"
|
||||
},
|
||||
"b": 1.5,
|
||||
"aaa": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
},
|
||||
"examples": {
|
||||
"Testerino": {
|
||||
"value": {
|
||||
"c": "Heya"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
},
|
||||
"TestRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"aaa": {
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "int64"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"b": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"fieldName": {
|
||||
"$ref": "#/components/schemas/TestNested"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"aaa",
|
||||
"b",
|
||||
"fieldName"
|
||||
]
|
||||
},
|
||||
"TestNested": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nesty": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"nesty"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
87
core/src/test/resources/T0021__example_parameters.json
Normal file
87
core/src/test/resources/T0021__example_parameters.json
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false,
|
||||
"examples": {
|
||||
"foo": {
|
||||
"value": "testing"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": "IDK"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
82
core/src/test/resources/T0023__required_param.json
Normal file
82
core/src/test/resources/T0023__required_param.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
82
core/src/test/resources/T0024__non_required_param.json
Normal file
82
core/src/test/resources/T0024__non_required_param.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": false,
|
||||
"deprecated": false
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
76
core/src/test/resources/T0025__default_field.json
Normal file
76
core/src/test/resources/T0025__default_field.json
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DefaultField"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"DefaultField": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"b": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
77
core/src/test/resources/T0026__nullable_field.json
Normal file
77
core/src/test/resources/T0026__nullable_field.json
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/NullableField"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"NullableField": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
117
core/src/test/resources/T0027__polymorphic_response.json
Normal file
117
core/src/test/resources/T0027__polymorphic_response.json
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/FlibbityGibbit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"ComplexGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"c": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.ComplexGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"c",
|
||||
"z",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"SimpleGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.SimpleGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"FlibbityGibbit": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ComplexGibbit"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SimpleGibbit"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
120
core/src/test/resources/T0028__polymorphic_list_response.json
Normal file
120
core/src/test/resources/T0028__polymorphic_list_response.json
Normal file
@ -0,0 +1,120 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/List-FlibbityGibbit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"ComplexGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"c": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.ComplexGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"c",
|
||||
"z",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"SimpleGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.SimpleGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"List-FlibbityGibbit": {
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ComplexGibbit"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SimpleGibbit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
120
core/src/test/resources/T0029__polymorphic_map_response.json
Normal file
120
core/src/test/resources/T0029__polymorphic_map_response.json
Normal file
@ -0,0 +1,120 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Map-String-FlibbityGibbit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"ComplexGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"c": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.ComplexGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"c",
|
||||
"z",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"SimpleGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.SimpleGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"Map-String-FlibbityGibbit": {
|
||||
"additionalProperties": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ComplexGibbit"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SimpleGibbit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
72
core/src/test/resources/T0030__simple_generic_response.json
Normal file
72
core/src/test/resources/T0030__simple_generic_response.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Gibbity-String"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Gibbity-String": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
75
core/src/test/resources/T0031__nested_generic_response.json
Normal file
75
core/src/test/resources/T0031__nested_generic_response.json
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Gibbity-Map"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Gibbity-Map": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Flibbity-Double"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Bibbity-Double": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"f": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.Bibbity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"f",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"Gibbity-Double": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.Gibbity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"Flibbity-Double": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Bibbity-Double"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/Gibbity-Double"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
169
core/src/test/resources/T0033__crazy_polymorphic_example.json
Normal file
169
core/src/test/resources/T0033__crazy_polymorphic_example.json
Normal file
@ -0,0 +1,169 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Flibbity-FlibbityGibbit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Bibbity-FlibbityGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"f": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ComplexGibbit"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SimpleGibbit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.Bibbity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"f",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"ComplexGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"b": {
|
||||
"type": "string"
|
||||
},
|
||||
"c": {
|
||||
"type": "number",
|
||||
"format": "int32"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.ComplexGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"b",
|
||||
"c",
|
||||
"z",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"SimpleGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"type": "string"
|
||||
},
|
||||
"z": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.SimpleGibbit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"Gibbity-FlibbityGibbit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ComplexGibbit"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/SimpleGibbit"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"io.bkbn.kompendium.core.fixtures.Gibbity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"a",
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"Flibbity-FlibbityGibbit": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Bibbity-FlibbityGibbit"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/Gibbity-FlibbityGibbit"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"operationId": "getThisDude",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
82
core/src/test/resources/T0035__override_parameter_name.json
Normal file
82
core/src/test/resources/T0035__override_parameter_name.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-User-Email",
|
||||
"in": "header",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": true,
|
||||
"deprecated": false
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TestResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"TestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"c": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"c"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
124
core/src/test/resources/T0036__nullable_fields.json
Normal file
124
core/src/test/resources/T0036__nullable_fields.json
Normal file
@ -0,0 +1,124 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProfileUpdateRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"ProfileUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"metadata": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/ProfileMetadataUpdateRequest"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mood": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"viewCount": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "int64"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
},
|
||||
"ProfileMetadataUpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"isPrivate": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"otherThing": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
84
core/src/test/resources/T0037__nullable_enum_field.json
Normal file
84
core/src/test/resources/T0037__nullable_enum_field.json
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||
"info": {
|
||||
"title": "Test API",
|
||||
"version": "1.33.7",
|
||||
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||
"termsOfService": "https://example.com",
|
||||
"contact": {
|
||||
"name": "Homer Simpson",
|
||||
"url": "https://gph.is/1NPUDiM",
|
||||
"email": "chunkylover53@aol.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||
}
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://myawesomeapi.com",
|
||||
"description": "Production instance of my API"
|
||||
},
|
||||
{
|
||||
"url": "https://staging.myawesomeapi.com",
|
||||
"description": "Where the fun stuff happens"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"tags": [],
|
||||
"summary": "Great Summary!",
|
||||
"description": "testing more",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A Successful Endeavor",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/NullableEnum"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deprecated": false
|
||||
},
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"webhooks": {},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"NullableEnum": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"a": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/TestEnum"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
},
|
||||
"TestEnum":
|
||||
{
|
||||
"enum": [
|
||||
"YES",
|
||||
"NO"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securitySchemes": {}
|
||||
},
|
||||
"security": [],
|
||||
"tags": []
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user