Граф коммитов

73 Коммитов

Автор SHA1 Сообщение Дата
Amar Zavery 6055d87f15 browserify changes 2018-01-31 17:38:19 -08:00
Jeremy Whitlock d2f577e206 Add support for registering custom formats
This commit basically makes it where you can pass in a list of custom
formats when creating the `SwaggerApi` object and/or you can call
`SwaggerApi#registerFormat(name, validator)`.  This just proxies through
to `ZSchema#registerFormat(name, validator)` so any value that is
permitted there is permitted here.

This is the bare minimum as there are no features around getting a list
of known formats, being warned if you are re-registering a format, etc.
But since those features were not asked for, this should do what is
required.

Fixes #74
2018-01-21 17:31:55 -07:00
Jeremy Whitlock 43e33d8d53 Support req.originalUrl for Sway#getPath and Parameter#getValue
Fixes #156
2017-12-01 20:13:53 -07:00
Jeremy Whitlock 09dec1c2e0 Support finding operations by operationId
`Sway#getOperation` and `Path#getOperation` have been updated to find
operations by their `operationId`.

Fixes #152
2017-10-10 23:07:48 -06:00
Jeremy Whitlock 6a5182bdf0 Fix TravisCI (and minor docs fix) 2017-07-07 22:29:55 -06:00
Jeremy Whitlock 85ebf329c6 Update dependencies
Fixes #141
2017-07-07 22:20:31 -06:00
Jeremy Whitlock 7c6e7f8337 Preparing for release 2016-04-04 16:12:00 -06:00
Guilherme Hermeto 1b7acd9743 fix issues with encoded slashes in path
path variables with encoded slashes were failing because the URI
component were being decoded too soon. Added test to verify fix.
2016-03-23 00:57:10 -07:00
Jeremy Whitlock c057f210de Pass through `params` and `schemaId` for validation errors
We've always normalized JSON Schema errors provided by z-schema but this
is unnecessary and in some cases not wanted.  This change will no longer
remove the `params` property of a validation error and will only remove
the `schemaId` property if its value is `undefined`.

Fixes #61
2016-02-13 11:54:20 -07:00
Jeremy Whitlock e27e896f39 Attempting to fix API doc rendering 2016-01-15 13:03:02 -07:00
Jeremy Whitlock 08ba90cbc8 Treat json-refs warnings as validation warnings
Also fixed up some jsdoc issues that didn't render right
2016-01-15 12:53:45 -07:00
Jeremy Whitlock d0a4b7b0ad Various changes related to consistency
* All type objects' `definition` property is now the original definition
  and is no longer the fully resolved definition
* All type objects now have a `definitionFullyResolved` that is the
  fully resolved definition *(Previously the `definition` property)
* We no longer overwrite `Operation.parameters` with the composite view
  of operation parameters
* We no longer overwrite `Operation.security` with the composite view of
  operation security *(This is now available as the
  `Operation#getSecurity` API)*
2016-01-15 12:32:00 -07:00
Jeremy Whitlock 14d0fb4b12 Removed `Parameter#getSchema` and renamed `Parameter.computedSchema` to `Parameter.schema`
Also made various jsdoc changes so that the generated `docs/API.md`
linked properly and read better.
2016-01-11 23:28:03 -07:00
Jeremy Whitlock aa776ef1ac Minor refactoring for jsdoc and object properties 2016-01-11 15:38:20 -07:00
Jeremy Whitlock 6092438bba Removed plugin support
Fixes #55
2016-01-11 10:21:42 -07:00
Jeremy Whitlock 6ca745d60e Added `Operation#getParameter(name, [location])`
Fixes #56
2016-01-08 16:18:01 -07:00
Jeremy Whitlock 52d4c431a5 Consistency changes per #52
Update `Operation#validateResponse` and `Response#validateResponse`
consistent with `Operation#validateRequest` and
`Response#validateRequest` respectively by wrapping all arguments in an
object so we can change things without breaking the API.

Fixes #52
2016-01-07 12:38:03 -07:00
Jeremy Whitlock 0668ca83b0 Cleaned up the jsdoc/API documentation
Fixes #49
2016-01-07 10:31:24 -07:00
Jeremy Whitlock b1626dc4d6 Treat missing references as structural errors 2016-01-06 21:21:13 -07:00
Jeremy Whitlock 877111239f Updated dependencies to prepare for #43 2016-01-06 14:07:32 -07:00
Jeremy Whitlock 3f72bcc1d1 Added a test for single item array query parameters 2016-01-05 15:17:10 -07:00
Xuan Li 379d6da77c Fixed registration of customValidators during creation of SwaggerApi. 2016-01-05 12:36:35 -08:00
Jeremy Whitlock 1a3102625c Removed callback support
Fixes #51
2015-12-29 11:04:25 -07:00
Jeremy Whitlock 4431d83a09 Moved all response-specific APIs to a Response type
Fixes #44
2015-12-27 17:25:55 -07:00
Jeremy Whitlock 473c6db5be Stop coercing values when the expected type is unknown
JSON Schema allows its schemas to omit the type property but Sway was
treating missing types as objects.  Not only is this wrong but it also
led to bugs like #46.
2015-11-25 14:43:19 -07:00
Jeremy Whitlock e9d432c579 Validate path parameter declarations that are empty
Fixes #40
2015-11-11 23:36:49 +01:00
Jeremy Whitlock 8f9fc36dbb Handle Buffer types when validating responses/parameter values
Fixes #42
2015-11-11 23:15:34 +01:00
Jeremy Whitlock 935fe9489d Update Operation#validateResponse to no longer throw an Error
* Instead of throwing an error when called with an undescribed status
  code we now put those details in the response structure
2015-11-02 15:16:18 -07:00
Jeremy Whitlock 4bd06f4181 breaking: removed SwaggerApi#getLastErrors and SwaggerApi#getLastWarnings
These APIs were removed in favor of `SwaggerApi#validate` returning the
validation results.  Not only is this API simpler but for the newly
created `Operation#validateRequest` and `Operation#validateResposne`,
these changes will result in a consistent approach for all validation APIs.
2015-11-02 10:53:48 -07:00
Jeremy Whitlock 9f07fcc19a Added request/response validation APIs
* Added Operation#validateRequest
* Added Operation#validateResponse
2015-11-02 10:06:43 -07:00
Jeremy Whitlock f391f6d6e0 Updated README with new binary sizes 2015-10-23 15:10:11 -06:00
Jeremy Whitlock db2c16a946 Update Parameter#getValue to work with http.ClientRequest or similar
Fixes #35
2015-10-22 15:37:37 -06:00
Jeremy Whitlock dc9adde5ae Code cleanup
* Broke out lib/types.js into separate files per type
* Broke out test/test-2.0.js into separate files per type
2015-10-20 17:52:34 -06:00
Jeremy Whitlock 823be33787 Fix bug with relative/YAML references
Fixes #17
2015-08-26 15:04:03 -07:00
Jeremy Whitlock fe6594dab5 Added Path object and related APIs 2015-08-24 23:58:38 -07:00
Jeremy Whitlock 7670613d8a Fixed browser binary size again
We will address localization as a whole at a later time but until then,
it does not make sense to have a binary that is huge just to somewhat
support localization.
2015-08-17 11:50:33 -06:00
Jeremy Whitlock 54ce7bc3a3 Renaming the project from swagger-core-api to sway 2015-08-12 15:09:26 -06:00
Jeremy Whitlock 9dc7e0191a Better documented the validator response
Fixes #12
2015-08-12 10:15:06 -06:00
Jeremy Whitlock 56ce69aa89 Namespaced the options passed to json-refs 2015-08-12 09:54:50 -06:00
Matthew Hamilton f20488349b Add SwaggerApi#getOperationsByTag to API 2015-08-05 23:28:22 -04:00
Jeremy Whitlock 1eda4fd6e4 Added Operation#getResponseExample API
Fixes #3
2015-08-04 17:20:43 -06:00
Jeremy Whitlock bb72553e0a Added parameter validation to ParameterValue
* ParameterValue.errors is now ParameterValue.error
* ParameterValue.valid returns whether or not the parameter value is
  valid

Fixes #7
2015-08-04 16:34:03 -06:00
Jeremy Whitlock 135ace045e Update build process and dependencies for size
Fixes #4
2015-08-03 09:10:42 -06:00
Jeremy Whitlock 865b2bcfb6 Updated invalid jsdoc for ParameterValue 2015-07-30 14:44:22 -06:00
Jeremy Whitlock a721204df5 Added API for procesing request parameters
* Parameter#getValue takes an http.CientRequest (or similar) and returns
  a wrapper object containing the raw value, the processed value and any
  errors that occured during processing.
2015-07-30 14:25:41 -06:00
Jeremy Whitlock f29642d388 Update SwaggerApi#getOperation to work with request objects 2015-07-24 14:12:36 -06:00
Jeremy Whitlock 4414f29a75 Compute and attach a path matcing RegExp to operations 2015-07-24 13:42:47 -06:00
Jeremy Whitlock 2094588879 Added semantic validation for circular composition/inheritance 2015-07-21 11:56:09 -06:00
Jeremy Whitlock de953b237e Added semantic validation for unique operationIds 2015-07-09 19:46:15 -06:00
Jeremy Whitlock 404f821291 Update json-refs 2015-07-08 22:49:47 -06:00