@api-client/core 0.19.10 → 0.19.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -63
- package/bin/test.ts +1 -12
- package/build/src/browser.d.ts +0 -15
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +0 -17
- package/build/src/browser.js.map +1 -1
- package/build/src/events/EventTypes.d.ts +0 -6
- package/build/src/events/EventTypes.d.ts.map +1 -1
- package/build/src/events/EventTypes.js +0 -2
- package/build/src/events/EventTypes.js.map +1 -1
- package/build/src/events/Events.d.ts +0 -2
- package/build/src/events/Events.d.ts.map +1 -1
- package/build/src/events/Events.js +0 -2
- package/build/src/events/Events.js.map +1 -1
- package/build/src/index.d.ts +0 -15
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +0 -17
- package/build/src/index.js.map +1 -1
- package/build/src/modeling/Bindings.d.ts +3 -3
- package/build/src/modeling/Bindings.d.ts.map +1 -1
- package/build/src/modeling/Bindings.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +5 -5
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
- package/build/src/modeling/DomainAssociation.js.map +1 -1
- package/build/src/modeling/DomainEntity.d.ts +2 -3
- package/build/src/modeling/DomainEntity.d.ts.map +1 -1
- package/build/src/modeling/DomainEntity.js +1 -1
- package/build/src/modeling/DomainEntity.js.map +1 -1
- package/build/src/modeling/DomainProperty.d.ts +2 -3
- package/build/src/modeling/DomainProperty.d.ts.map +1 -1
- package/build/src/modeling/DomainProperty.js +1 -1
- package/build/src/modeling/DomainProperty.js.map +1 -1
- package/build/src/modeling/ai/types.d.ts +2 -2
- package/build/src/modeling/ai/types.d.ts.map +1 -1
- package/build/src/modeling/ai/types.js.map +1 -1
- package/build/src/{amf → modeling/amf}/DataValueGenerator.d.ts +1 -1
- package/build/src/modeling/amf/DataValueGenerator.d.ts.map +1 -0
- package/build/src/{amf → modeling/amf}/DataValueGenerator.js +2 -3
- package/build/src/modeling/amf/DataValueGenerator.js.map +1 -0
- package/build/src/modeling/amf/ShapeGenerator.d.ts +20 -20
- package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -1
- package/build/src/modeling/amf/ShapeGenerator.js +16 -18
- package/build/src/modeling/amf/ShapeGenerator.js.map +1 -1
- package/build/src/modeling/amf/core_types.d.ts +9 -0
- package/build/src/modeling/amf/core_types.d.ts.map +1 -0
- package/build/src/modeling/amf/core_types.js +45 -0
- package/build/src/modeling/amf/core_types.js.map +1 -0
- package/build/src/models/http-flows/LegacyTranslator.js +1 -1
- package/build/src/models/http-flows/LegacyTranslator.js.map +1 -1
- package/build/src/runtime/http-runner/HttpFlows.js +1 -1
- package/build/src/runtime/http-runner/HttpFlows.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.js +0 -1
- package/package.json +11 -14
- package/src/events/EventTypes.ts +0 -2
- package/src/events/Events.ts +0 -2
- package/src/modeling/Bindings.ts +3 -3
- package/src/modeling/DomainAssociation.ts +5 -5
- package/src/modeling/DomainEntity.ts +3 -4
- package/src/modeling/DomainProperty.ts +3 -4
- package/src/modeling/ai/types.ts +2 -2
- package/src/{amf → modeling/amf}/DataValueGenerator.ts +3 -4
- package/src/modeling/amf/ShapeGenerator.ts +45 -61
- package/src/modeling/amf/core_types.ts +47 -0
- package/src/models/http-flows/LegacyTranslator.ts +1 -1
- package/src/runtime/http-runner/HttpFlows.ts +1 -1
- package/tests/unit/{amf → modeling/amf}/data_value_generator.spec.ts +2 -2
- package/tests/unit/modeling/amf/shape_generator.spec.ts +146 -167
- package/tests/unit/modeling/domain_asociation.spec.ts +13 -13
- package/tests/unit/runtime/runners/http_assertion_runner.spec.ts +1 -1
- package/tests/unit/runtime/runners/http_flow_runner.spec.ts +1 -1
- package/tests/unit/runtime/runners/project_runner.spec.ts +1 -1
- package/tests/unit/runtime/runners/request_runner.spec.ts +1 -1
- package/tests/unit/runtime/runners/serial_runner.spec.ts +1 -1
- package/build/src/amf/AmfMixin.d.ts +0 -396
- package/build/src/amf/AmfMixin.d.ts.map +0 -1
- package/build/src/amf/AmfMixin.js +0 -1138
- package/build/src/amf/AmfMixin.js.map +0 -1
- package/build/src/amf/AmfSerializer.d.ts +0 -137
- package/build/src/amf/AmfSerializer.d.ts.map +0 -1
- package/build/src/amf/AmfSerializer.js +0 -1947
- package/build/src/amf/AmfSerializer.js.map +0 -1
- package/build/src/amf/AmfTypes.d.ts +0 -25
- package/build/src/amf/AmfTypes.d.ts.map +0 -1
- package/build/src/amf/AmfTypes.js +0 -143
- package/build/src/amf/AmfTypes.js.map +0 -1
- package/build/src/amf/ApiExampleGenerator.d.ts +0 -40
- package/build/src/amf/ApiExampleGenerator.d.ts.map +0 -1
- package/build/src/amf/ApiExampleGenerator.js +0 -112
- package/build/src/amf/ApiExampleGenerator.js.map +0 -1
- package/build/src/amf/ApiMonacoSchemaGenerator.d.ts +0 -68
- package/build/src/amf/ApiMonacoSchemaGenerator.d.ts.map +0 -1
- package/build/src/amf/ApiMonacoSchemaGenerator.js +0 -248
- package/build/src/amf/ApiMonacoSchemaGenerator.js.map +0 -1
- package/build/src/amf/ApiSchemaGenerator.d.ts +0 -56
- package/build/src/amf/ApiSchemaGenerator.d.ts.map +0 -1
- package/build/src/amf/ApiSchemaGenerator.js +0 -94
- package/build/src/amf/ApiSchemaGenerator.js.map +0 -1
- package/build/src/amf/ApiSchemaValues.d.ts +0 -111
- package/build/src/amf/ApiSchemaValues.d.ts.map +0 -1
- package/build/src/amf/ApiSchemaValues.js +0 -463
- package/build/src/amf/ApiSchemaValues.js.map +0 -1
- package/build/src/amf/DataValueGenerator.d.ts.map +0 -1
- package/build/src/amf/DataValueGenerator.js.map +0 -1
- package/build/src/amf/Parsing.d.ts +0 -48
- package/build/src/amf/Parsing.d.ts.map +0 -1
- package/build/src/amf/Parsing.js +0 -2
- package/build/src/amf/Parsing.js.map +0 -1
- package/build/src/amf/Utils.d.ts +0 -37
- package/build/src/amf/Utils.d.ts.map +0 -1
- package/build/src/amf/Utils.js +0 -169
- package/build/src/amf/Utils.js.map +0 -1
- package/build/src/amf/data-node/DataNodeBase.d.ts +0 -34
- package/build/src/amf/data-node/DataNodeBase.d.ts.map +0 -1
- package/build/src/amf/data-node/DataNodeBase.js +0 -77
- package/build/src/amf/data-node/DataNodeBase.js.map +0 -1
- package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts +0 -15
- package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts.map +0 -1
- package/build/src/amf/data-node/JsonDataNodeGenerator.js +0 -23
- package/build/src/amf/data-node/JsonDataNodeGenerator.js.map +0 -1
- package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts +0 -14
- package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts.map +0 -1
- package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js +0 -48
- package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js.map +0 -1
- package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts +0 -22
- package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts.map +0 -1
- package/build/src/amf/data-node/XmlDataNodeGenerator.js +0 -34
- package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +0 -1
- package/build/src/amf/definitions/Amf.d.ts +0 -363
- package/build/src/amf/definitions/Amf.d.ts.map +0 -1
- package/build/src/amf/definitions/Amf.js +0 -3
- package/build/src/amf/definitions/Amf.js.map +0 -1
- package/build/src/amf/definitions/Api.d.ts +0 -383
- package/build/src/amf/definitions/Api.d.ts.map +0 -1
- package/build/src/amf/definitions/Api.js +0 -2
- package/build/src/amf/definitions/Api.js.map +0 -1
- package/build/src/amf/definitions/Base.d.ts +0 -12
- package/build/src/amf/definitions/Base.d.ts.map +0 -1
- package/build/src/amf/definitions/Base.js +0 -2
- package/build/src/amf/definitions/Base.js.map +0 -1
- package/build/src/amf/definitions/Namespace.d.ts +0 -327
- package/build/src/amf/definitions/Namespace.d.ts.map +0 -1
- package/build/src/amf/definitions/Namespace.js +0 -346
- package/build/src/amf/definitions/Namespace.js.map +0 -1
- package/build/src/amf/definitions/Shapes.d.ts +0 -312
- package/build/src/amf/definitions/Shapes.d.ts.map +0 -1
- package/build/src/amf/definitions/Shapes.js +0 -87
- package/build/src/amf/definitions/Shapes.js.map +0 -1
- package/build/src/amf/models/AmfDataNode.d.ts +0 -67
- package/build/src/amf/models/AmfDataNode.d.ts.map +0 -1
- package/build/src/amf/models/AmfDataNode.js +0 -192
- package/build/src/amf/models/AmfDataNode.js.map +0 -1
- package/build/src/amf/shape/ShapeBase.d.ts +0 -74
- package/build/src/amf/shape/ShapeBase.d.ts.map +0 -1
- package/build/src/amf/shape/ShapeBase.js +0 -93
- package/build/src/amf/shape/ShapeBase.js.map +0 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +0 -47
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts.map +0 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +0 -420
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +0 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +0 -85
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts.map +0 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +0 -852
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +0 -1
- package/build/src/events/amf/AmfEventTypes.d.ts +0 -7
- package/build/src/events/amf/AmfEventTypes.d.ts.map +0 -1
- package/build/src/events/amf/AmfEventTypes.js +0 -7
- package/build/src/events/amf/AmfEventTypes.js.map +0 -1
- package/build/src/events/amf/AmfEvents.d.ts +0 -34
- package/build/src/events/amf/AmfEvents.d.ts.map +0 -1
- package/build/src/events/amf/AmfEvents.js +0 -63
- package/build/src/events/amf/AmfEvents.js.map +0 -1
- package/build/src/mocking/RandExp.d.ts +0 -55
- package/build/src/mocking/RandExp.d.ts.map +0 -1
- package/build/src/mocking/RandExp.js +0 -302
- package/build/src/mocking/RandExp.js.map +0 -1
- package/build/src/mocking/lib/ret.d.ts +0 -16
- package/build/src/mocking/lib/ret.d.ts.map +0 -1
- package/build/src/mocking/lib/ret.js +0 -284
- package/build/src/mocking/lib/ret.js.map +0 -1
- package/data/apis/APIC-187/APIC-187.raml +0 -21
- package/data/apis/APIC-187/dataType.raml +0 -132
- package/data/apis/APIC-187/example.raml +0 -84
- package/data/apis/APIC-188/APIC-188.raml +0 -21
- package/data/apis/APIC-188/dataType.raml +0 -132
- package/data/apis/APIC-188/example.raml +0 -84
- package/data/apis/APIC-233/APIC-233.raml +0 -15
- package/data/apis/APIC-391/APIC-391.raml +0 -44
- package/data/apis/APIC-391/examples/post-body-request-example.raml +0 -7
- package/data/apis/APIC-483/APIC-483.raml +0 -16
- package/data/apis/APIC-483/example/list-of-bank-succ.json +0 -32
- package/data/apis/APIC-483/schema/response-retrieve-list-bank.json +0 -68
- package/data/apis/APIC-487/APIC-487.raml +0 -36
- package/data/apis/APIC-655/APIC-655.raml +0 -44
- package/data/apis/APIC-655/delivery.json +0 -12
- package/data/apis/APIC-689/APIC-689.raml +0 -20
- package/data/apis/APIC-690/APIC-690.raml +0 -17
- package/data/apis/APIC-690/datatypes/Address.raml +0 -10
- package/data/apis/APIC-690/datatypes/Customer.raml +0 -17
- package/data/apis/APIC-690/examples/CustomerExample2.raml +0 -17
- package/data/apis/APIC-690/examples/CustomersExample.raml +0 -34
- package/data/apis/SE-10469/Purchase-Order-oagis-id-dd32f9c6c01048a19e15c423c9c741ae.json +0 -1383
- package/data/apis/SE-10469/SE-10469.raml +0 -11
- package/data/apis/SE-13092/Examples/PersonExample.raml +0 -7
- package/data/apis/SE-13092/SE-13092.raml +0 -37
- package/data/apis/SE-13092/datatypes/Address.raml +0 -5
- package/data/apis/SE-13092/datatypes/InlineType.raml +0 -5
- package/data/apis/SE-13092/datatypes/Person.raml +0 -15
- package/data/apis/SE-22063/SE-22063.raml +0 -14
- package/data/apis/SE-22063/stock.raml +0 -41
- package/data/apis/amf-helper-api/amf-helper-api.raml +0 -1024
- package/data/apis/amf-helper-api/examples/comment-example.json +0 -42
- package/data/apis/amf-helper-api/examples/commentCreateRequest-example.json +0 -7
- package/data/apis/amf-helper-api/examples/commentList-example.json +0 -48
- package/data/apis/amf-helper-api/examples/person.json +0 -14
- package/data/apis/amf-helper-api/examples/person.raml +0 -13
- package/data/apis/amf-helper-api/examples/person.xml +0 -14
- package/data/apis/amf-helper-api/libraries/comment-lib.raml +0 -143
- package/data/apis/amf-helper-api/library.raml +0 -7
- package/data/apis/amf-helper-api/schemas/person.json +0 -104
- package/data/apis/amf-helper-api/schemas/person.xsd +0 -26
- package/data/apis/amf-helper-api/traits/file.raml +0 -33
- package/data/apis/amf-helper-api/traits/pagination.raml +0 -80
- package/data/apis/amf-helper-api/traits/results.raml +0 -19
- package/data/apis/amf-helper-api/traits/visibility.raml +0 -14
- package/data/apis/amf-helper-api/types/app-person.raml +0 -101
- package/data/apis/amf-helper-api/types/dimensions.raml +0 -24
- package/data/apis/amf-helper-api/types/external-type.raml +0 -7
- package/data/apis/amf-helper-api/types/image.raml +0 -23
- package/data/apis/amf-helper-api/types/product.raml +0 -52
- package/data/apis/amf-helper-api/types/resource.raml +0 -11
- package/data/apis/amf-helper-api/types/standard-request.raml +0 -50
- package/data/apis/amf-helper-api/types/user.raml +0 -37
- package/data/apis/arc-demo-api/arc-demo-api.raml +0 -468
- package/data/apis/arc-demo-api/examples/e400.xml +0 -4
- package/data/apis/arc-demo-api/examples/e401.xml +0 -4
- package/data/apis/arc-demo-api/examples/e404.xml +0 -4
- package/data/apis/arc-demo-api/examples/image.xml +0 -5
- package/data/apis/arc-demo-api/examples/messages-example.json +0 -22
- package/data/apis/arc-demo-api/examples/messages-sent-example.json +0 -15
- package/data/apis/arc-demo-api/examples/person.json +0 -14
- package/data/apis/arc-demo-api/examples/person.url.encoded +0 -1
- package/data/apis/arc-demo-api/examples/person.xml +0 -14
- package/data/apis/arc-demo-api/examples/product.xml +0 -9
- package/data/apis/arc-demo-api/library.raml +0 -36
- package/data/apis/arc-demo-api/resourceTypes/app-person.raml +0 -49
- package/data/apis/arc-demo-api/resourceTypes/example-types.raml +0 -45
- package/data/apis/arc-demo-api/resourceTypes/image.raml +0 -23
- package/data/apis/arc-demo-api/resourceTypes/message-sent-type.raml +0 -23
- package/data/apis/arc-demo-api/resourceTypes/message-type.raml +0 -33
- package/data/apis/arc-demo-api/resourceTypes/product.raml +0 -52
- package/data/apis/arc-demo-api/resourceTypes/resource.raml +0 -11
- package/data/apis/arc-demo-api/schemas/error-response.xsd +0 -11
- package/data/apis/arc-demo-api/schemas/image.xsd +0 -11
- package/data/apis/arc-demo-api/schemas/person.json +0 -104
- package/data/apis/arc-demo-api/schemas/person.xsd +0 -26
- package/data/apis/arc-demo-api/schemas/product.xsd +0 -17
- package/data/apis/arc-demo-api/securitySchemes/basic.raml +0 -5
- package/data/apis/arc-demo-api/securitySchemes/oauth_2_0.raml +0 -29
- package/data/apis/arc-demo-api/securitySchemes/x-custom.raml +0 -26
- package/data/apis/arc-demo-api/traits/adminable.raml +0 -23
- package/data/apis/arc-demo-api/traits/pagination.raml +0 -83
- package/data/apis/arc-demo-api/traits/rate-limited.raml +0 -9
- package/data/apis/async-api/async-api.yaml +0 -96
- package/data/apis/example-generator-api/contact-email-example.raml +0 -6
- package/data/apis/example-generator-api/contact-example.raml +0 -5
- package/data/apis/example-generator-api/contact-fax-example.raml +0 -5
- package/data/apis/example-generator-api/contact-website-example.raml +0 -2
- package/data/apis/example-generator-api/example-1.raml +0 -6
- package/data/apis/example-generator-api/example-2.raml +0 -9
- package/data/apis/example-generator-api/example-3.raml +0 -4
- package/data/apis/example-generator-api/example-4.raml +0 -2
- package/data/apis/example-generator-api/example-5.raml +0 -4
- package/data/apis/example-generator-api/example-6.raml +0 -2
- package/data/apis/example-generator-api/example-7.raml +0 -5
- package/data/apis/example-generator-api/example-generator-api.raml +0 -423
- package/data/apis/example-generator-api/example.json +0 -14
- package/data/apis/example-generator-api/example.xml +0 -15
- package/data/apis/example-generator-api/example.xsd +0 -26
- package/data/apis/example-generator-api/examples/employee.raml +0 -7
- package/data/apis/example-generator-api/examples/employees.raml +0 -7
- package/data/apis/example-generator-api/linked-named-example.raml +0 -21
- package/data/apis/example-generator-api/named-example-with-link.raml +0 -5
- package/data/apis/example-generator-api/named-example.raml +0 -9
- package/data/apis/example-generator-api/user-json-example.raml +0 -17
- package/data/apis/example-generator-api/user-raml-example.raml +0 -37
- package/data/apis/example-generator-api/user.json +0 -8
- package/data/apis/example-generator-api/user.raml +0 -18
- package/data/apis/example-generator-api/users-json-example.raml +0 -17
- package/data/apis/example-generator-api/users-raml-example.raml +0 -32
- package/data/apis/example-generator-api/users.json +0 -8
- package/data/apis/expanded-api/expanded-api.raml +0 -8
- package/data/apis/flattened-api/flattened-api.raml +0 -8
- package/data/apis/multiple-servers/multiple-servers.yaml +0 -112
- package/data/apis/oas-3-api/oas-3-api.yaml +0 -356
- package/data/apis/oas-date/oas-date.yaml +0 -28
- package/data/apis/oas-types/oas-types.yaml +0 -159
- package/data/apis/oas-unions/oas-unions.yaml +0 -75
- package/data/apis/petstore/petstore.yaml +0 -954
- package/data/apis/raml-date/raml-date.raml +0 -28
- package/data/apis/recursive/recursive.raml +0 -14
- package/data/apis/schema-api/examples/person.json +0 -14
- package/data/apis/schema-api/examples/person.raml +0 -14
- package/data/apis/schema-api/examples/person.url.encoded +0 -1
- package/data/apis/schema-api/examples/person.xml +0 -14
- package/data/apis/schema-api/library/demo-types.raml +0 -43
- package/data/apis/schema-api/schema-api.raml +0 -656
- package/data/apis/schema-api/schemas/person.json +0 -104
- package/data/apis/schema-api/schemas/person.xsd +0 -26
- package/data/apis/schema-api/types/DemoPerson.raml +0 -67
- package/data/apis/secured-api/oauth-2-custom-settings.raml +0 -143
- package/data/apis/secured-api/oauth2-header-delivery.raml +0 -13
- package/data/apis/secured-api/oauth2-no-delivery.raml +0 -8
- package/data/apis/secured-api/oauth2-no-grants.raml +0 -12
- package/data/apis/secured-api/oauth2-pkce.raml +0 -13
- package/data/apis/secured-api/oauth2-query-delivery.raml +0 -13
- package/data/apis/secured-api/oauth_1_0.raml +0 -8
- package/data/apis/secured-api/oauth_1_0_no-settings.raml +0 -3
- package/data/apis/secured-api/oauth_1_0_no-signature.raml +0 -7
- package/data/apis/secured-api/oauth_1_0_signature.raml +0 -8
- package/data/apis/secured-api/passthrough-querystring.raml +0 -16
- package/data/apis/secured-api/passthrough.raml +0 -24
- package/data/apis/secured-api/secured-api.raml +0 -231
- package/data/apis/secured-api/x-custom.raml +0 -33
- package/data/apis/secured-api/x-other.raml +0 -29
- package/data/apis/secured-api/x-query-string.raml +0 -16
- package/data/apis/tracked-examples/datatypes/employee.raml +0 -5
- package/data/apis/tracked-examples/examples/employee.raml +0 -4
- package/data/apis/tracked-examples/examples/employees.raml +0 -8
- package/data/apis/tracked-examples/tracked-to-linked.raml +0 -28
- package/data/model.js +0 -129
- package/data/models/APIC-187.json +0 -11416
- package/data/models/APIC-188.json +0 -11416
- package/data/models/APIC-233.json +0 -539
- package/data/models/APIC-391.json +0 -1903
- package/data/models/APIC-483.json +0 -3110
- package/data/models/APIC-487.json +0 -1225
- package/data/models/APIC-655.json +0 -3145
- package/data/models/APIC-689.json +0 -797
- package/data/models/APIC-690.json +0 -5992
- package/data/models/SE-10469.json +0 -22898
- package/data/models/SE-13092.json +0 -2769
- package/data/models/SE-22063.json +0 -2314
- package/data/models/amf-helper-api.json +0 -84457
- package/data/models/arc-demo-api.json +0 -52041
- package/data/models/async-api.json +0 -3227
- package/data/models/example-generator-api.json +0 -45209
- package/data/models/expanded-api.json +0 -251
- package/data/models/flattened-api.json +0 -251
- package/data/models/multiple-servers.json +0 -2769
- package/data/models/oas-3-api.json +0 -10590
- package/data/models/oas-date.json +0 -637
- package/data/models/oas-types.json +0 -5352
- package/data/models/oas-unions.json +0 -1935
- package/data/models/petstore.json +0 -27712
- package/data/models/raml-date.json +0 -1114
- package/data/models/recursive.json +0 -610
- package/data/models/schema-api.json +0 -35527
- package/data/models/secured-api.json +0 -21071
- package/data/models/tracked-to-linked.json +0 -1914
- package/src/amf/AmfMixin.ts +0 -1726
- package/src/amf/AmfSerializer.ts +0 -2358
- package/src/amf/AmfTypes.ts +0 -147
- package/src/amf/ApiExampleGenerator.ts +0 -122
- package/src/amf/ApiMonacoSchemaGenerator.ts +0 -332
- package/src/amf/ApiSchemaGenerator.ts +0 -115
- package/src/amf/ApiSchemaValues.ts +0 -509
- package/src/amf/Parsing.ts +0 -50
- package/src/amf/Utils.ts +0 -172
- package/src/amf/data-node/DataNodeBase.ts +0 -83
- package/src/amf/data-node/JsonDataNodeGenerator.ts +0 -24
- package/src/amf/data-node/README.md +0 -3
- package/src/amf/data-node/UrlEncodedDataNodeGenerator.ts +0 -49
- package/src/amf/data-node/XmlDataNodeGenerator.ts +0 -46
- package/src/amf/definitions/Amf.ts +0 -440
- package/src/amf/definitions/Api.ts +0 -445
- package/src/amf/definitions/Base.ts +0 -13
- package/src/amf/definitions/Namespace.ts +0 -357
- package/src/amf/definitions/Shapes.ts +0 -438
- package/src/amf/models/AmfDataNode.ts +0 -210
- package/src/amf/shape/README.md +0 -4
- package/src/amf/shape/ShapeBase.ts +0 -174
- package/src/amf/shape/ShapeJsonSchemaGenerator.ts +0 -457
- package/src/amf/shape/ShapeXmlSchemaGenerator.ts +0 -933
- package/src/events/amf/AmfEventTypes.ts +0 -6
- package/src/events/amf/AmfEvents.ts +0 -78
- package/src/mocking/RandExp.ts +0 -335
- package/src/mocking/lib/ret.ts +0 -279
- package/tests/unit/amf/APIC-187.spec.ts +0 -41
- package/tests/unit/amf/APIC-188.spec.ts +0 -30
- package/tests/unit/amf/APIC-233.spec.ts +0 -32
- package/tests/unit/amf/APIC-391.spec.ts +0 -39
- package/tests/unit/amf/APIC-487.spec.ts +0 -44
- package/tests/unit/amf/APIC-655.spec.ts +0 -41
- package/tests/unit/amf/APIC-689.spec.ts +0 -28
- package/tests/unit/amf/APIC-690.spec.ts +0 -93
- package/tests/unit/amf/AmfLoader.ts +0 -538
- package/tests/unit/amf/AmfMixin.spec.ts +0 -1707
- package/tests/unit/amf/ApiExampleGenerator.spec.ts +0 -250
- package/tests/unit/amf/ApiMonacoSchemaGenerator.spec.ts +0 -183
- package/tests/unit/amf/ApiSchemaValues.spec.ts +0 -602
- package/tests/unit/amf/Namepsace.spec.ts +0 -494
- package/tests/unit/amf/SE-10469.spec.ts +0 -35
- package/tests/unit/amf/SE-13092.spec.ts +0 -64
- package/tests/unit/amf/SE-22063.spec.ts +0 -45
- package/tests/unit/amf/raml-examples.spec.ts +0 -43
- package/tests/unit/amf/schema_gen_array.spec.ts +0 -199
- package/tests/unit/amf/schema_gen_oas.spec.ts +0 -140
- package/tests/unit/amf/schema_gen_object.spec.ts +0 -279
- package/tests/unit/amf/schema_gen_scalar.spec.ts +0 -143
- package/tests/unit/amf/schema_gen_union.spec.ts +0 -401
- package/tests/unit/amf/schema_gen_unknown.spec.ts +0 -42
- package/tests/unit/amf/schema_gen_xml.spec.ts +0 -726
- package/tests/unit/amf/serializer/APIC-483.spec.ts +0 -36
- package/tests/unit/amf/serializer/Anotations.spec.ts +0 -50
- package/tests/unit/amf/serializer/Api.spec.ts +0 -210
- package/tests/unit/amf/serializer/Documentation.spec.ts +0 -52
- package/tests/unit/amf/serializer/Endpoints.spec.ts +0 -172
- package/tests/unit/amf/serializer/Operations.spec.ts +0 -330
- package/tests/unit/amf/serializer/Parameters.spec.ts +0 -149
- package/tests/unit/amf/serializer/PayloadExamples.spec.ts +0 -152
- package/tests/unit/amf/serializer/Security.spec.ts +0 -626
- package/tests/unit/amf/serializer/Server.spec.ts +0 -78
- package/tests/unit/amf/serializer/Shapes.spec.ts +0 -304
- package/tests/unit/amf/serializer/SourceMaps.spec.ts +0 -52
- package/tests/unit/amf/shapes/ShapeXmlSchemaGenerator.spec.ts +0 -28
- package/tests/unit/amf/tracked-to-linked.spec.ts +0 -90
- package/tests/unit/amf/xml-data-processing.spec.ts +0 -217
- package/tests/unit/events/amf.spec.ts +0 -151
|
@@ -1,626 +0,0 @@
|
|
|
1
|
-
import { test } from '@japa/runner'
|
|
2
|
-
import { AmfLoader } from '../AmfLoader.js'
|
|
3
|
-
import { AmfSerializer } from '../../../../src/amf/AmfSerializer.js'
|
|
4
|
-
import type { IAmfDocument } from '../../../../src/amf/definitions/Amf.js'
|
|
5
|
-
import { AmfNamespace } from '../../../../src/amf/definitions/Namespace.js'
|
|
6
|
-
import type {
|
|
7
|
-
IApiSecurityApiKeySettings,
|
|
8
|
-
IApiSecurityHttpSettings,
|
|
9
|
-
IApiSecurityOAuth1Settings,
|
|
10
|
-
IApiSecurityOAuth2Settings,
|
|
11
|
-
IApiSecurityOpenIdConnectSettings,
|
|
12
|
-
} from '../../../../src/amf/definitions/Api.js'
|
|
13
|
-
|
|
14
|
-
const loader = new AmfLoader()
|
|
15
|
-
|
|
16
|
-
test.group('OAS security / operation security', (group) => {
|
|
17
|
-
let api: IAmfDocument
|
|
18
|
-
let serializer: AmfSerializer
|
|
19
|
-
group.setup(async () => {
|
|
20
|
-
api = await loader.getGraph('oas-3-api')
|
|
21
|
-
serializer = new AmfSerializer(api)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
test('serializes oauth2 scheme', ({ assert }) => {
|
|
25
|
-
const security = loader.lookupOperationSecurity(api, '/pets', 'get')
|
|
26
|
-
const result = serializer.securityRequirement(security[0])
|
|
27
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
28
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
29
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
30
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
31
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
32
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
33
|
-
const [scheme] = result.schemes
|
|
34
|
-
assert.include(
|
|
35
|
-
scheme.types,
|
|
36
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
37
|
-
'scheme has the types'
|
|
38
|
-
)
|
|
39
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
40
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
41
|
-
assert.equal(scheme.name, 'petstore_auth', 'scheme has name')
|
|
42
|
-
|
|
43
|
-
const secScheme = scheme.scheme!
|
|
44
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
45
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
46
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
47
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
48
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
49
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
50
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
51
|
-
assert.equal(secScheme.name, 'petstore_auth', 'settings has name')
|
|
52
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
53
|
-
assert.isUndefined(secScheme.description, 'settings has description')
|
|
54
|
-
assert.equal(secScheme.type, 'OAuth 2.0', 'settings has type')
|
|
55
|
-
|
|
56
|
-
const oauth2Settings = secScheme.settings as IApiSecurityOAuth2Settings
|
|
57
|
-
assert.deepEqual(oauth2Settings.authorizationGrants, [], 'has the authorizationGrants')
|
|
58
|
-
assert.lengthOf(oauth2Settings.flows, 1, 'has the flows')
|
|
59
|
-
assert.typeOf(oauth2Settings.sourceMaps, 'object', 'oauth2Settings has source maps')
|
|
60
|
-
|
|
61
|
-
const [flow] = oauth2Settings.flows
|
|
62
|
-
assert.typeOf(flow.scopes, 'array', 'the flow has scopes')
|
|
63
|
-
assert.lengthOf(flow.scopes, 2, 'the flow has 2 scopes')
|
|
64
|
-
assert.equal(flow.authorizationUri, 'http://example.org/api/oauth/dialog', 'the flow has authorizationUri')
|
|
65
|
-
assert.equal(flow.refreshUri, 'http://example.org/api/refresh', 'the flow has refreshUri')
|
|
66
|
-
assert.equal(flow.flow, 'implicit', 'the flow has flow')
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
test('serializes API key scheme', ({ assert }) => {
|
|
70
|
-
const security = loader.lookupOperationSecurity(api, '/securityCombo', 'get')
|
|
71
|
-
const result = serializer.securityRequirement(security[1])
|
|
72
|
-
assert.equal(result.id, security[1]['@id'], 'has the id')
|
|
73
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
74
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
75
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
76
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
77
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
78
|
-
const [scheme] = result.schemes
|
|
79
|
-
assert.include(
|
|
80
|
-
scheme.types,
|
|
81
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
82
|
-
'scheme has the types'
|
|
83
|
-
)
|
|
84
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
85
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
86
|
-
assert.equal(scheme.name, 'api_key', 'scheme has name')
|
|
87
|
-
|
|
88
|
-
const secScheme = scheme.scheme!
|
|
89
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
90
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
91
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
92
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
93
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
94
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
95
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
96
|
-
assert.equal(secScheme.name, 'api_key', 'settings has name')
|
|
97
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
98
|
-
assert.isUndefined(secScheme.description, 'settings has description')
|
|
99
|
-
assert.equal(secScheme.type, 'Api Key', 'settings has type')
|
|
100
|
-
|
|
101
|
-
const apiKeySettings = secScheme.settings as IApiSecurityApiKeySettings
|
|
102
|
-
assert.typeOf(apiKeySettings.sourceMaps, 'object', 'apiKeySettings has source maps')
|
|
103
|
-
assert.deepEqual(apiKeySettings.customDomainProperties, [], 'apiKeySettings has customDomainProperties')
|
|
104
|
-
assert.equal(apiKeySettings.in, 'header', 'apiKeySettings has in')
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
test('serializes OpenID scheme', ({ assert }) => {
|
|
108
|
-
const security = loader.lookupOperationSecurity(api, '/securityCombo', 'get')
|
|
109
|
-
const result = serializer.securityRequirement(security[2])
|
|
110
|
-
assert.equal(result.id, security[2]['@id'], 'has the id')
|
|
111
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
112
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
113
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
114
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
115
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
116
|
-
const [scheme] = result.schemes
|
|
117
|
-
assert.include(
|
|
118
|
-
scheme.types,
|
|
119
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
120
|
-
'scheme has the types'
|
|
121
|
-
)
|
|
122
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
123
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
124
|
-
assert.equal(scheme.name, 'OpenID', 'scheme has name')
|
|
125
|
-
|
|
126
|
-
const secScheme = scheme.scheme!
|
|
127
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
128
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
129
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
130
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
131
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
132
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
133
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
134
|
-
assert.equal(secScheme.name, 'OpenID', 'settings has name')
|
|
135
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
136
|
-
assert.equal(secScheme.description, 'Using OpenId', 'settings has description')
|
|
137
|
-
assert.equal(secScheme.type, 'openIdConnect', 'settings has type')
|
|
138
|
-
|
|
139
|
-
const apiKeySettings = secScheme.settings as IApiSecurityOpenIdConnectSettings
|
|
140
|
-
assert.typeOf(apiKeySettings.sourceMaps, 'object', 'apiKeySettings has source maps')
|
|
141
|
-
assert.deepEqual(apiKeySettings.customDomainProperties, [], 'apiKeySettings has customDomainProperties')
|
|
142
|
-
assert.equal(apiKeySettings.url, 'https://example.com/.well-known/openid-configuration', 'apiKeySettings has in')
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
test('serializes basic HTTP', ({ assert }) => {
|
|
146
|
-
const security = loader.lookupOperationSecurity(api, '/http-security', 'get')
|
|
147
|
-
const result = serializer.securityRequirement(security[0])
|
|
148
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
149
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
150
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
151
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
152
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
153
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
154
|
-
const [scheme] = result.schemes
|
|
155
|
-
assert.include(
|
|
156
|
-
scheme.types,
|
|
157
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
158
|
-
'scheme has the types'
|
|
159
|
-
)
|
|
160
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
161
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
162
|
-
assert.equal(scheme.name, 'BasicAuth', 'scheme has name')
|
|
163
|
-
|
|
164
|
-
const secScheme = scheme.scheme!
|
|
165
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
166
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
167
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
168
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
169
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
170
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
171
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
172
|
-
assert.equal(secScheme.name, 'BasicAuth', 'settings has name')
|
|
173
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
174
|
-
assert.equal(secScheme.description, 'A basic HTTP scheme', 'settings has description')
|
|
175
|
-
assert.equal(secScheme.type, 'http', 'settings has type')
|
|
176
|
-
|
|
177
|
-
const secSettings = secScheme.settings as IApiSecurityHttpSettings
|
|
178
|
-
assert.typeOf(secSettings.sourceMaps, 'object', 'secSettings has source maps')
|
|
179
|
-
assert.deepEqual(secSettings.customDomainProperties, [], 'secSettings has customDomainProperties')
|
|
180
|
-
assert.equal(secSettings.scheme, 'basic', 'secSettings has in')
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
test('serializes Bearer auth', ({ assert }) => {
|
|
184
|
-
const security = loader.lookupOperationSecurity(api, '/http-security', 'post')
|
|
185
|
-
const result = serializer.securityRequirement(security[0])
|
|
186
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
187
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
188
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
189
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
190
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
191
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
192
|
-
const [scheme] = result.schemes
|
|
193
|
-
assert.include(
|
|
194
|
-
scheme.types,
|
|
195
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
196
|
-
'scheme has the types'
|
|
197
|
-
)
|
|
198
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
199
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
200
|
-
assert.equal(scheme.name, 'BearerAuth', 'scheme has name')
|
|
201
|
-
|
|
202
|
-
const secScheme = scheme.scheme!
|
|
203
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
204
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
205
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
206
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
207
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
208
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
209
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
210
|
-
assert.equal(secScheme.name, 'BearerAuth', 'settings has name')
|
|
211
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
212
|
-
assert.equal(secScheme.description, 'Bearer form of authentication', 'settings has description')
|
|
213
|
-
assert.equal(secScheme.type, 'http', 'settings has type')
|
|
214
|
-
|
|
215
|
-
const secSettings = secScheme.settings as IApiSecurityHttpSettings
|
|
216
|
-
assert.typeOf(secSettings.sourceMaps, 'object', 'secSettings has source maps')
|
|
217
|
-
assert.deepEqual(secSettings.customDomainProperties, [], 'secSettings has customDomainProperties')
|
|
218
|
-
assert.equal(secSettings.scheme, 'bearer', 'secSettings has in')
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
test('serializes auth with cookies', ({ assert }) => {
|
|
222
|
-
const security = loader.lookupOperationSecurity(api, '/http-security', 'patch')
|
|
223
|
-
const result = serializer.securityRequirement(security[0])
|
|
224
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
225
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
226
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
227
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
228
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
229
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
230
|
-
const [scheme] = result.schemes
|
|
231
|
-
assert.include(
|
|
232
|
-
scheme.types,
|
|
233
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
234
|
-
'scheme has the types'
|
|
235
|
-
)
|
|
236
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
237
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
238
|
-
assert.equal(scheme.name, 'cookieAuth', 'scheme has name')
|
|
239
|
-
|
|
240
|
-
const secScheme = scheme.scheme!
|
|
241
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
242
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
243
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
244
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
245
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
246
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
247
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
248
|
-
assert.equal(secScheme.name, 'cookieAuth', 'settings has name')
|
|
249
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
250
|
-
assert.isUndefined(secScheme.description, 'settings has description')
|
|
251
|
-
assert.equal(secScheme.type, 'Api Key', 'settings has type')
|
|
252
|
-
|
|
253
|
-
const secSettings = secScheme.settings as IApiSecurityApiKeySettings
|
|
254
|
-
assert.typeOf(secSettings.sourceMaps, 'object', 'secSettings has source maps')
|
|
255
|
-
assert.deepEqual(secSettings.customDomainProperties, [], 'secSettings has customDomainProperties')
|
|
256
|
-
assert.equal(secSettings.in, 'cookie', 'secSettings has in')
|
|
257
|
-
assert.equal(secSettings.name, 'JSESSIONID', 'secSettings has in')
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
test('serializes auth with query params', ({ assert }) => {
|
|
261
|
-
const security = loader.lookupOperationSecurity(api, '/http-security', 'options')
|
|
262
|
-
const result = serializer.securityRequirement(security[0])
|
|
263
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
264
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
265
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
266
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
267
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
268
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
269
|
-
const [scheme] = result.schemes
|
|
270
|
-
assert.include(
|
|
271
|
-
scheme.types,
|
|
272
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
273
|
-
'scheme has the types'
|
|
274
|
-
)
|
|
275
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
276
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
277
|
-
assert.equal(scheme.name, 'ApiKeyQuery', 'scheme has name')
|
|
278
|
-
|
|
279
|
-
const secScheme = scheme.scheme!
|
|
280
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
281
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
282
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
283
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
284
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
285
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
286
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
287
|
-
assert.equal(secScheme.name, 'ApiKeyQuery', 'settings has name')
|
|
288
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
289
|
-
assert.equal(secScheme.description, 'API Key in a query parameter', 'settings has description')
|
|
290
|
-
assert.equal(secScheme.type, 'Api Key', 'settings has type')
|
|
291
|
-
|
|
292
|
-
const secSettings = secScheme.settings as IApiSecurityApiKeySettings
|
|
293
|
-
assert.typeOf(secSettings.sourceMaps, 'object', 'secSettings has source maps')
|
|
294
|
-
assert.deepEqual(secSettings.customDomainProperties, [], 'secSettings has customDomainProperties')
|
|
295
|
-
assert.equal(secSettings.in, 'query', 'secSettings has in')
|
|
296
|
-
assert.equal(secSettings.name, 'X-API-Key', 'secSettings has in')
|
|
297
|
-
})
|
|
298
|
-
})
|
|
299
|
-
|
|
300
|
-
test.group('RAML security / operation security', (group) => {
|
|
301
|
-
let api: IAmfDocument
|
|
302
|
-
let serializer: AmfSerializer
|
|
303
|
-
group.setup(async () => {
|
|
304
|
-
api = await loader.getGraph('secured-api')
|
|
305
|
-
serializer = new AmfSerializer()
|
|
306
|
-
serializer.amf = api
|
|
307
|
-
})
|
|
308
|
-
test('serializes basic HTTP', ({ assert }) => {
|
|
309
|
-
const security = loader.lookupOperationSecurity(api, '/basic', 'get')
|
|
310
|
-
const result = serializer.securityRequirement(security[0])
|
|
311
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
312
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
313
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
314
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
315
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
316
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
317
|
-
const [scheme] = result.schemes
|
|
318
|
-
assert.include(
|
|
319
|
-
scheme.types,
|
|
320
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
321
|
-
'scheme has the types'
|
|
322
|
-
)
|
|
323
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
324
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
325
|
-
assert.equal(scheme.name, 'basic', 'scheme has name')
|
|
326
|
-
|
|
327
|
-
const settings = scheme.scheme!
|
|
328
|
-
assert.include(settings.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
329
|
-
assert.deepEqual(settings.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
330
|
-
assert.deepEqual(settings.headers, [], 'settings has no headers')
|
|
331
|
-
assert.deepEqual(settings.queryParameters, [], 'settings has no queryParameters')
|
|
332
|
-
assert.deepEqual(settings.responses, [], 'settings has no responses')
|
|
333
|
-
assert.typeOf(settings.sourceMaps, 'object', 'settings has source maps')
|
|
334
|
-
assert.equal(settings.name, 'basic', 'settings has name')
|
|
335
|
-
assert.equal(settings.description, 'This API supports Basic Authentication.\n', 'settings has description')
|
|
336
|
-
assert.equal(settings.type, 'Basic Authentication', 'settings has type')
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
test('serializes digest', ({ assert }) => {
|
|
340
|
-
const security = loader.lookupOperationSecurity(api, '/digest', 'get')
|
|
341
|
-
const result = serializer.securityRequirement(security[0])
|
|
342
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
343
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
344
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
345
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
346
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
347
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
348
|
-
const [scheme] = result.schemes
|
|
349
|
-
assert.include(
|
|
350
|
-
scheme.types,
|
|
351
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
352
|
-
'scheme has the types'
|
|
353
|
-
)
|
|
354
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
355
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
356
|
-
assert.equal(scheme.name, 'digest', 'scheme has name')
|
|
357
|
-
|
|
358
|
-
const settings = scheme.scheme!
|
|
359
|
-
assert.include(settings.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
360
|
-
assert.deepEqual(settings.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
361
|
-
assert.deepEqual(settings.headers, [], 'settings has no headers')
|
|
362
|
-
assert.deepEqual(settings.queryParameters, [], 'settings has no queryParameters')
|
|
363
|
-
assert.deepEqual(settings.responses, [], 'settings has no responses')
|
|
364
|
-
assert.typeOf(settings.sourceMaps, 'object', 'settings has source maps')
|
|
365
|
-
assert.equal(settings.name, 'digest', 'settings has name')
|
|
366
|
-
assert.equal(
|
|
367
|
-
settings.description,
|
|
368
|
-
'This API supports DigestSecurityScheme Authentication.\n',
|
|
369
|
-
'settings has description'
|
|
370
|
-
)
|
|
371
|
-
assert.equal(settings.type, 'Digest Authentication', 'settings has type')
|
|
372
|
-
})
|
|
373
|
-
|
|
374
|
-
test('serializes passthrough', ({ assert }) => {
|
|
375
|
-
const security = loader.lookupOperationSecurity(api, '/passthrough', 'get')
|
|
376
|
-
const result = serializer.securityRequirement(security[0])
|
|
377
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
378
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
379
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
380
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
381
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
382
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
383
|
-
const [scheme] = result.schemes
|
|
384
|
-
assert.include(
|
|
385
|
-
scheme.types,
|
|
386
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
387
|
-
'scheme has the types'
|
|
388
|
-
)
|
|
389
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
390
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
391
|
-
assert.equal(scheme.name, 'passthrough', 'scheme has name')
|
|
392
|
-
|
|
393
|
-
const settings = scheme.scheme!
|
|
394
|
-
assert.include(settings.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
395
|
-
assert.deepEqual(settings.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
396
|
-
assert.lengthOf(settings.headers, 1, 'settings has headers')
|
|
397
|
-
assert.lengthOf(settings.queryParameters, 2, 'settings has queryParameters')
|
|
398
|
-
assert.deepEqual(settings.responses, [], 'settings has no responses')
|
|
399
|
-
assert.typeOf(settings.sourceMaps, 'object', 'settings has source maps')
|
|
400
|
-
assert.equal(settings.name, 'passthrough', 'settings has name')
|
|
401
|
-
assert.equal(settings.description, 'This API supports Pass Through Authentication.\n', 'settings has description')
|
|
402
|
-
assert.equal(settings.type, 'Pass Through', 'settings has type')
|
|
403
|
-
})
|
|
404
|
-
|
|
405
|
-
test('serializes passthrough with a query string', ({ assert }) => {
|
|
406
|
-
const security = loader.lookupOperationSecurity(api, '/passthrough-query-string', 'get')
|
|
407
|
-
const result = serializer.securityRequirement(security[0])
|
|
408
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
409
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
410
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
411
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
412
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
413
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
414
|
-
const [scheme] = result.schemes
|
|
415
|
-
assert.include(
|
|
416
|
-
scheme.types,
|
|
417
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
418
|
-
'scheme has the types'
|
|
419
|
-
)
|
|
420
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
421
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
422
|
-
assert.equal(scheme.name, 'passthroughQueryString', 'scheme has name')
|
|
423
|
-
|
|
424
|
-
const settings = scheme.scheme!
|
|
425
|
-
assert.include(settings.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
426
|
-
assert.deepEqual(settings.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
427
|
-
assert.deepEqual(settings.headers, [], 'settings has headers')
|
|
428
|
-
assert.deepEqual(settings.queryParameters, [], 'settings has queryParameters')
|
|
429
|
-
assert.deepEqual(settings.responses, [], 'settings has no responses')
|
|
430
|
-
assert.typeOf(settings.sourceMaps, 'object', 'settings has source maps')
|
|
431
|
-
assert.typeOf(settings.queryString, 'object', 'settings has queryString')
|
|
432
|
-
assert.equal(settings.name, 'passthroughQueryString', 'settings has name')
|
|
433
|
-
assert.equal(settings.description, 'This API supports Pass Through Authentication.\n', 'settings has description')
|
|
434
|
-
assert.equal(settings.type, 'Pass Through', 'settings has type')
|
|
435
|
-
})
|
|
436
|
-
|
|
437
|
-
test('serializes custom scheme (#1)', ({ assert }) => {
|
|
438
|
-
const security = loader.lookupOperationSecurity(api, '/custom1', 'get')
|
|
439
|
-
const result = serializer.securityRequirement(security[0])
|
|
440
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
441
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
442
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
443
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
444
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
445
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
446
|
-
const [scheme] = result.schemes
|
|
447
|
-
assert.include(
|
|
448
|
-
scheme.types,
|
|
449
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
450
|
-
'scheme has the types'
|
|
451
|
-
)
|
|
452
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
453
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
454
|
-
assert.equal(scheme.name, 'custom1', 'scheme has name')
|
|
455
|
-
|
|
456
|
-
const settings = scheme.scheme!
|
|
457
|
-
assert.include(settings.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
458
|
-
assert.deepEqual(settings.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
459
|
-
assert.lengthOf(settings.headers, 1, 'settings has headers')
|
|
460
|
-
assert.lengthOf(settings.queryParameters, 2, 'settings has queryParameters')
|
|
461
|
-
assert.lengthOf(settings.responses, 2, 'settings has responses')
|
|
462
|
-
assert.typeOf(settings.sourceMaps, 'object', 'settings has source maps')
|
|
463
|
-
assert.isUndefined(settings.queryString, 'settings has no queryString')
|
|
464
|
-
assert.equal(settings.name, 'custom1', 'settings has name')
|
|
465
|
-
assert.typeOf(settings.description, 'string', 'settings has description')
|
|
466
|
-
assert.equal(settings.type, 'x-my-custom', 'settings has type')
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
test('serializes custom scheme with a query string (#1)', ({ assert }) => {
|
|
470
|
-
const security = loader.lookupOperationSecurity(api, '/custom-query-string', 'get')
|
|
471
|
-
const result = serializer.securityRequirement(security[0])
|
|
472
|
-
const [scheme] = result.schemes
|
|
473
|
-
const settings = scheme.scheme!
|
|
474
|
-
assert.typeOf(settings.queryString, 'object', 'settings has queryString')
|
|
475
|
-
})
|
|
476
|
-
|
|
477
|
-
test('serializes custom scheme (#2)', ({ assert }) => {
|
|
478
|
-
const security = loader.lookupOperationSecurity(api, '/custom2', 'get')
|
|
479
|
-
const result = serializer.securityRequirement(security[0])
|
|
480
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
481
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
482
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
483
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
484
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
485
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
486
|
-
const [scheme] = result.schemes
|
|
487
|
-
assert.include(
|
|
488
|
-
scheme.types,
|
|
489
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
490
|
-
'scheme has the types'
|
|
491
|
-
)
|
|
492
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
493
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
494
|
-
assert.equal(scheme.name, 'custom2', 'scheme has name')
|
|
495
|
-
|
|
496
|
-
const settings = scheme.scheme!
|
|
497
|
-
assert.include(settings.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
498
|
-
assert.deepEqual(settings.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
499
|
-
assert.deepEqual(settings.headers, [], 'settings has headers')
|
|
500
|
-
assert.lengthOf(settings.queryParameters, 2, 'settings has queryParameters')
|
|
501
|
-
assert.lengthOf(settings.responses, 1, 'settings has responses')
|
|
502
|
-
assert.typeOf(settings.sourceMaps, 'object', 'settings has source maps')
|
|
503
|
-
assert.isUndefined(settings.queryString, 'settings has no queryString')
|
|
504
|
-
assert.equal(settings.name, 'custom2', 'settings has name')
|
|
505
|
-
assert.typeOf(settings.description, 'string', 'settings has description')
|
|
506
|
-
assert.equal(settings.type, 'x-custom', 'settings has type')
|
|
507
|
-
})
|
|
508
|
-
|
|
509
|
-
test('serializes oauth2 scheme', ({ assert }) => {
|
|
510
|
-
const security = loader.lookupOperationSecurity(api, '/oauth2', 'post')
|
|
511
|
-
const result = serializer.securityRequirement(security[0])
|
|
512
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
513
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
514
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
515
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
516
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
517
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
518
|
-
const [scheme] = result.schemes
|
|
519
|
-
assert.include(
|
|
520
|
-
scheme.types,
|
|
521
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
522
|
-
'scheme has the types'
|
|
523
|
-
)
|
|
524
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
525
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
526
|
-
assert.equal(scheme.name, 'oauth2', 'scheme has name')
|
|
527
|
-
|
|
528
|
-
const secScheme = scheme.scheme!
|
|
529
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
530
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
531
|
-
assert.lengthOf(secScheme.headers, 1, 'settings has headers')
|
|
532
|
-
assert.lengthOf(secScheme.queryParameters, 1, 'settings has queryParameters')
|
|
533
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
534
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
535
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
536
|
-
assert.equal(secScheme.name, 'oauth2', 'settings has name')
|
|
537
|
-
assert.equal(secScheme.displayName, 'Regular OAuth 2.0 definition', 'settings has displayName')
|
|
538
|
-
assert.isUndefined(secScheme.description, 'settings has description')
|
|
539
|
-
assert.equal(secScheme.type, 'OAuth 2.0', 'settings has type')
|
|
540
|
-
|
|
541
|
-
const oauth2Settings = secScheme.settings as IApiSecurityOAuth2Settings
|
|
542
|
-
assert.deepEqual(oauth2Settings.authorizationGrants, [], 'has the authorizationGrants')
|
|
543
|
-
assert.lengthOf(oauth2Settings.flows, 1, 'has the flows')
|
|
544
|
-
assert.typeOf(oauth2Settings.sourceMaps, 'object', 'oauth2Settings has source maps')
|
|
545
|
-
|
|
546
|
-
const [flow] = oauth2Settings.flows
|
|
547
|
-
assert.typeOf(flow.scopes, 'array', 'the flow has scopes')
|
|
548
|
-
assert.lengthOf(flow.scopes, 2, 'the flow has 2 scopes')
|
|
549
|
-
assert.equal(flow.authorizationUri, 'https://auth.com', 'the flow has authorizationUri')
|
|
550
|
-
assert.equal(flow.accessTokenUri, 'https://token.com', 'the flow has accessTokenUri')
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
test('serializes oauth2 scheme with annotations', ({ assert }) => {
|
|
554
|
-
const security = loader.lookupOperationSecurity(api, '/oauth2-with-annotations', 'get')
|
|
555
|
-
const result = serializer.securityRequirement(security[0])
|
|
556
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
557
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
558
|
-
const [scheme] = result.schemes
|
|
559
|
-
const secScheme = scheme.scheme!
|
|
560
|
-
const oauth2Settings = secScheme.settings as IApiSecurityOAuth2Settings
|
|
561
|
-
assert.lengthOf(oauth2Settings.customDomainProperties, 1, 'has custom properties')
|
|
562
|
-
})
|
|
563
|
-
|
|
564
|
-
test('serializes oauth2 scheme with grant types', ({ assert }) => {
|
|
565
|
-
const security = loader.lookupOperationSecurity(api, '/oauth2-with-grant-list', 'get')
|
|
566
|
-
const result = serializer.securityRequirement(security[0])
|
|
567
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
568
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
569
|
-
const [scheme] = result.schemes
|
|
570
|
-
const secScheme = scheme.scheme!
|
|
571
|
-
const oauth2Settings = secScheme.settings as IApiSecurityOAuth2Settings
|
|
572
|
-
assert.deepEqual(oauth2Settings.authorizationGrants, ['authorization_code'], 'has the authorizationGrants')
|
|
573
|
-
})
|
|
574
|
-
|
|
575
|
-
test('serializes oauth1 scheme', ({ assert }) => {
|
|
576
|
-
const security = loader.lookupOperationSecurity(api, '/oauth1', 'get')
|
|
577
|
-
const result = serializer.securityRequirement(security[0])
|
|
578
|
-
assert.equal(result.id, security[0]['@id'], 'has the id')
|
|
579
|
-
assert.include(result.types, AmfNamespace.aml.vocabularies.security.SecurityRequirement, 'has the types')
|
|
580
|
-
assert.deepEqual(result.customDomainProperties, [], 'has no customDomainProperties')
|
|
581
|
-
assert.typeOf(result.sourceMaps, 'object', 'has source maps')
|
|
582
|
-
assert.typeOf(result.schemes, 'array', 'has schemes')
|
|
583
|
-
assert.lengthOf(result.schemes, 1, 'has single scheme')
|
|
584
|
-
const [scheme] = result.schemes
|
|
585
|
-
assert.include(
|
|
586
|
-
scheme.types,
|
|
587
|
-
AmfNamespace.aml.vocabularies.security.ParametrizedSecurityScheme,
|
|
588
|
-
'scheme has the types'
|
|
589
|
-
)
|
|
590
|
-
assert.deepEqual(scheme.customDomainProperties, [], 'scheme has no customDomainProperties')
|
|
591
|
-
assert.typeOf(scheme.sourceMaps, 'object', 'scheme has source maps')
|
|
592
|
-
assert.equal(scheme.name, 'oauth1', 'scheme has name')
|
|
593
|
-
|
|
594
|
-
const secScheme = scheme.scheme!
|
|
595
|
-
assert.include(secScheme.types, AmfNamespace.aml.vocabularies.security.SecurityScheme, 'settings has the types')
|
|
596
|
-
assert.deepEqual(secScheme.customDomainProperties, [], 'settings has no customDomainProperties')
|
|
597
|
-
assert.deepEqual(secScheme.headers, [], 'settings has headers')
|
|
598
|
-
assert.deepEqual(secScheme.queryParameters, [], 'settings has queryParameters')
|
|
599
|
-
assert.deepEqual(secScheme.responses, [], 'settings has responses')
|
|
600
|
-
assert.typeOf(secScheme.sourceMaps, 'object', 'settings has source maps')
|
|
601
|
-
assert.isUndefined(secScheme.queryString, 'settings has no queryString')
|
|
602
|
-
assert.equal(secScheme.name, 'oauth1', 'settings has name')
|
|
603
|
-
assert.isUndefined(secScheme.displayName, 'settings has no displayName')
|
|
604
|
-
assert.equal(
|
|
605
|
-
secScheme.description,
|
|
606
|
-
'OAuth 1.0 continues to be supported for all API requests, but OAuth 2.0 is now preferred.',
|
|
607
|
-
'settings has description'
|
|
608
|
-
)
|
|
609
|
-
assert.equal(secScheme.type, 'OAuth 1.0', 'settings has type')
|
|
610
|
-
|
|
611
|
-
const oauth1Settings = secScheme.settings as IApiSecurityOAuth1Settings
|
|
612
|
-
assert.deepEqual(oauth1Settings.signatures, ['RSA-SHA1', 'HMAC-SHA1'], 'has the authorizationGrants')
|
|
613
|
-
assert.equal(oauth1Settings.authorizationUri, 'http://api.domain.com/oauth1/authorize', 'has the authorizationUri')
|
|
614
|
-
assert.equal(
|
|
615
|
-
oauth1Settings.requestTokenUri,
|
|
616
|
-
'http://api.domain.com/oauth1/request_token',
|
|
617
|
-
'has the requestTokenUri'
|
|
618
|
-
)
|
|
619
|
-
assert.equal(
|
|
620
|
-
oauth1Settings.tokenCredentialsUri,
|
|
621
|
-
'http://api.domain.com/oauth1/access_token',
|
|
622
|
-
'has the tokenCredentialsUri'
|
|
623
|
-
)
|
|
624
|
-
assert.typeOf(oauth1Settings.sourceMaps, 'object', 'oauth2Settings has source maps')
|
|
625
|
-
})
|
|
626
|
-
})
|