Skip to content

Commit

Permalink
Merge pull request #74 from aspida/develop
Browse files Browse the repository at this point in the history
chore(release): 0.13.0
  • Loading branch information
solufa authored Nov 14, 2020
2 parents bb3e6f3 + 69823d1 commit c2902ee
Show file tree
Hide file tree
Showing 157 changed files with 1,459 additions and 1,379 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.13.0](https://github.com/aspida/openapi2aspida/compare/v0.12.0...v0.13.0) (2020-11-14)


### ⚠ BREAKING CHANGES

* change property without required to strict

### Features

* change property without required to strict ([8452b49](https://github.com/aspida/openapi2aspida/commit/8452b49aeb20a6c053990d70df8a9ea269faa84f))

## [0.12.0](https://github.com/aspida/openapi2aspida/compare/v0.11.0...v0.12.0) (2020-11-07)


Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<br />
<br />

## Breaking change (2020/11/14) :warning:

Since openapi2aspida >= `0.13.0` , optional for aspida only if the 'required' property of OpenAPI is set to `false`.

## Getting Started

Compatible with yaml/json of OpenAPI3.0/Swagger2.0
Expand Down
20 changes: 17 additions & 3 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import fs from 'fs'
import { ConfigFile } from '../src/getConfig'
import build from '../src'
import path from 'path'

function readDirRecursive(dirPath: string): string[] {
return fs
.readdirSync(dirPath, { withFileTypes: true })
.map(file =>
file.isDirectory()
? readDirRecursive(path.join(dirPath, file.name))
: [path.join(dirPath, file.name)]
)
.reduce((acc, x) => acc.concat(x), [])
}

describe('cli test', () => {
beforeAll(() => fs.mkdirSync('_samples'))
Expand All @@ -16,9 +28,11 @@ describe('cli test', () => {
input: `_${config.input}`
})[0]

expect(fs.readFileSync(`_${config.input}/$api.ts`, 'utf8')).toBe(
fs.readFileSync(`${config.input}/$api.ts`, 'utf8').replace(/\r/g, '')
)
for (const filePath of readDirRecursive(config.input)) {
expect(fs.readFileSync(`_${filePath}`, 'utf8')).toBe(
fs.readFileSync(filePath, 'utf8').replace(/\r/g, '')
)
}
})
)
})
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openapi2aspida",
"version": "0.12.0",
"version": "0.13.0",
"description": "Convert OpenAPI 3.0 or Swagger 2.0 definitions into aspida",
"author": "Solufa <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -93,22 +93,22 @@
"devDependencies": {
"@types/jest": "^26.0.15",
"@types/js-yaml": "^3.12.5",
"@types/minimist": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"eslint": "^7.12.1",
"@types/minimist": "^1.2.1",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"eslint-config-standard": "^16.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.2",
"eslint-plugin-standard": "^4.1.0",
"jest": "^26.6.3",
"prettier": "^2.1.2",
"standard-version": "^9.0.0",
"ts-jest": "^26.4.3",
"ts-jest": "^26.4.4",
"typescript": "^4.0.5"
}
}
1 change: 1 addition & 0 deletions samples/docs.baikalplatform.com/common/v2.2/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":{"description":"Common data for 4th Platform APIs","version":"2.2.1","title":"Common data for 4th Platform APIs","termsOfService":"https://www.telefonica.es/es/","contact":{"name":"4th Platform Team","email":"[email protected]"}},"definitions":{"MoneyAmount":{"type":"object","description":"Money amount","required":["value","currency"],"properties":{"value":{"type":"number","format":"float","multipleOf":0.01,"description":"Amount value"},"currency":{"type":"string","description":"Currency code in which the amount is expressed. ISO 4217"},"tax_included":{"type":"boolean","description":"true if the amount includes government taxes","default":false}}},"Address":{"type":"object","description":"User's address information","required":["formatted"],"properties":{"formatted":{"type":"string","description":"Full address, formatted for display"},"street_address":{"type":"string","description":"Address information"},"postal_code":{"type":"string","description":"Postal code associated to the address"},"locality":{"type":"string","description":"City or locality where the user lives"},"country":{"type":"string","description":"Country name. Format iso3166-1"}}},"IdDocument":{"type":"object","description":"User legal id document information","required":["country","type","value"],"properties":{"country":{"type":"string","description":"Country of issuance of the id_document. Format iso3166-1"},"type":{"type":"string","description":"Type of document (e.g. passport)"},"value":{"type":"string","description":"Id number associated to the id_document"}}},"CommonQuota":{"type":"object","description":"Quota common information","required":["id","name","categories","start_date","max","consumed","remaining"],"properties":{"id":{"type":"string","description":"Unique identifier of this quota.\n This is a unique id, i.e.: it's the instantiation for a user of a mobile/landline/internet plan charactericic, voucher, etc."},"name":{"type":"string","description":"Name of this quota. User Friendly field."},"description":{"type":"string","description":"Description of this quota. User Friendly field."},"categories":{"type":"array","description":"List of categories of a quota","items":{"$ref":"#/definitions/QuotaCategory"}},"start_date":{"type":"string","description":"start UTC time for the application of the quota","format":"date-time"},"end_date":{"type":"string","description":"end UTC time for the application of the quota. Will not appear for quotas that never expire","format":"date-time"},"active":{"type":"boolean","description":"Whether the quota is active or is currently inhibited","default":true},"max":{"type":"number","description":"maximum amount allowed by current quota. -1 is interpreted as there is no limit","format":"decimal"},"consumed":{"type":"number","description":"amount already consumed of current quota by this phone_number (as identified in the request URL)","format":"decimal"},"remaining":{"type":"number","description":"amount remaining of the quota. -1 when quota is unlimited","format":"decimal"},"is_shared":{"type":"boolean","description":"whether this quota is shared with other lines or not","default":false},"tags":{"type":"array","description":"list of freely defined strings that tag the quota based on some criteria","items":{"type":"string"}}}},"QuotaDestination":{"type":"string","description":"Destinations for which the quota applies. Multiples values must be understood as logical OR.\n Possible values are restricted to country values indicated in ISO 3166-1 alfa-2 and a list of enumerated values indicating 'telefonica', 'non-telefonica', 'rural', 'local', 'regional', 'national', 'international', 'mobile', 'landline', 'any'.","pattern":"^(telefonica|non-telefonica|rural|local|regional|national|international|mobile|landline|any|[A-Z]{2})$","default":["national"]},"QuotaCategory":{"type":"string","enum":["general","promotion","voucher","application","pay_per_use"],"default":"general"},"QuotaTimeBand":{"type":"string","description":"Timebands when the quota applies. Multiples values must be understood as logical OR","enum":["day","night","morning","evening","weekends","workdays","all"],"default":["all"]}},"parameters":{"x-correlator":{"in":"header","name":"x-correlator","type":"string","required":false,"description":"Correlation id for the different services"},"ID":{"in":"path","name":"id","type":"string","required":true,"description":"Resource identifier"},"Page":{"name":"page","in":"query","description":"Requested page number for pagination purpose. If not included, page 1 is returned.","required":false,"type":"integer","format":"int32","default":1},"PerPage":{"name":"per_page","in":"query","description":"Number of element per page. If not included, a default number of 100 elements per page are returned.","required":false,"type":"integer","format":"int32","default":100},"QuotaCategories":{"name":"categories","description":"List of wanted categories separated by commas","in":"query","required":false,"type":"array","items":{"type":"string","enum":["general","promotion","voucher","application","pay_per_use"]}}}}
1 change: 1 addition & 0 deletions samples/docs.baikalplatform.com/errors/v2.0/errors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":{"description":"Common errors for 4th Platform APIs","version":"2.0.2","title":"Common errors for 4th Platform APIs","termsOfService":"https://www.telefonica.es/es/","contact":{"name":"4th Platform Team","email":"[email protected]"}},"definitions":{"ModelError":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"A human readable description of what the event represent"}}},"InvalidArgument":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["INVALID_ARGUMENT"],"default":"INVALID_ARGUMENT","description":"Client specified an invalid argument, request body or query param."}}},{"$ref":"#/definitions/ModelError"}]},"Conflict":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["CONFLICT"],"default":"CONFLICT","description":"A specified resource duplicate entry found"}}},{"$ref":"#/definitions/ModelError"}]},"FailedPrecondition":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["FAILED_PRECONDITION"],"default":"FAILED_PRECONDITION","description":"Request cannot be executed in the current system state."}}},{"$ref":"#/definitions/ModelError"}]},"OutOfRange":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["OUT_OF_RANGE"],"default":"OUT_OF_RANGE","description":"Client specified an invalid range"}}},{"$ref":"#/definitions/ModelError"}]},"Unauthenticated":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["UNAUTHENTICATED"],"default":"UNAUTHENTICATED","description":"Request not authenticated due to missing, invalid, or expired credentials."}}},{"$ref":"#/definitions/ModelError"}]},"PermissionDenied":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["PERMISSION_DENIED"],"default":"PERMISSION_DENIED","description":"Client does not have sufficient permissions to perform this action."}}},{"$ref":"#/definitions/ModelError"}]},"NotFound":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["NOT_FOUND"],"default":"NOT_FOUND","description":"The specified resource is not found"}}},{"$ref":"#/definitions/ModelError"}]},"Aborted":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["ABORTED"],"default":"ABORTED","description":"Concurrency conflict."}}},{"$ref":"#/definitions/ModelError"}]},"AlreadyExists":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["ALREADY_EXISTS"],"default":"ALREADY_EXISTS","description":"The resource that a client tried to create already exists."}}},{"$ref":"#/definitions/ModelError"}]},"TooManyRequests":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["TOO_MANY_REQUESTS"],"default":"TOO_MANY_REQUESTS","description":"Either out of resource quota or reaching rate limiting."}}},{"$ref":"#/definitions/ModelError"}]},"DataLoss":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["DATA_LOSS"],"default":"DATA_LOSS","description":"Unrecoverable data loss or data corruption."}}},{"$ref":"#/definitions/ModelError"}]},"Internal":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["INTERNAL"],"default":"INTERNAL","description":"Unknown server error.Typically a server bug."}}},{"$ref":"#/definitions/ModelError"}]},"BadGateway":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["BAD_GATEWAY"],"default":"BAD_GATEWAY","description":"Couldn't reach an upstream internal service."}}},{"$ref":"#/definitions/ModelError"}]},"Unavailable":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["UNAVAILABLE"],"default":"UNAVAILABLE","description":"Request timeout exceeded"}}},{"$ref":"#/definitions/ModelError"}]},"Timeout":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["TIMEOUT"],"default":"TIMEOUT","description":"Request timeout exceeded"}}},{"$ref":"#/definitions/ModelError"}]},"NotImplemented":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["NOT_IMPLEMENTED"],"default":"NOT_IMPLEMENTED","description":"This functionality is not implemented yet"}}},{"$ref":"#/definitions/ModelError"}]},"AuthenticationRequired":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["AUTHENTICATION_REQUIRED"],"default":"AUTHENTICATION_REQUIRED","description":"New authentication is required"}}},{"$ref":"#/definitions/ModelError"}]},"NotFoundAndOutOfRange":{"allOf":[{"type":"object","required":["code"],"properties":{"code":{"type":"string","enum":["NOT_FOUND","OUT_OF_RANGE"],"default":"NOT_FOUND","description":"Not found."}}},{"$ref":"#/definitions/ModelError"}]}}}
Loading

0 comments on commit c2902ee

Please sign in to comment.