Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Dictionary Types #3

Merged
merged 11 commits into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR Test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 15.x, 16.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm test
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![npm](https://img.shields.io/npm/v/rapini.svg)](http://npm.im/rapini)
[![License](https://img.shields.io/github/license/rametta/rapini)](https://opensource.org/licenses/Apache-2.0)
[![PR Test](https://github.com/rametta/rapini/actions/workflows/test.yml/badge.svg)](https://github.com/rametta/rapini/actions/workflows/test.yml)

# :leafy_green: Rapini - OpenAPI to React Query & Axios

Expand Down
31 changes: 31 additions & 0 deletions example-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,34 @@ components:
username:
type: string
description: The user name.
# MyDictionary ---> { [key: string]: string }
MyDictionary:
type: object
additionalProperties:
type: string
# MyDictionaryAny ---> { [key: string]: any }
MyDictionaryAny:
type: object
additionalProperties: true # can also be `additionalProperties: {}`
# MyDictionaryStringArray ---> { [key: string]: string[] }
MyDictionaryStringArray:
type: object
additionalProperties:
type: array
items:
type: string
# MyDictionaryRef ---> { [key: string]: User }
MyDictionaryRef:
type: object
additionalProperties:
$ref: "#/components/schemas/User"
# MyDictionaryValue ---> { [key: string]: { code?: number; text?: string } }
MyDictionaryValue:
type: object
additionalProperties:
type: object
properties:
code:
type: integer
text:
type: string
Loading