diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..9d0b71a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +build +dist diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f6bae6..a91e038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ 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. +## [1.3.0](https://github.com/nrccua/apollo-rest-utils/compare/1.2.2...1.3.0) (2022-01-06) + + +### Changes + +* [E4E-87]: Update to fix missing path params when a body is specified ([655fd4c](https://github.com/nrccua/apollo-rest-utils/commit/655fd4c3ae23df53d4e0bc1dfd3a4d9c7cf6d3fd)) +* Merge pull request #12 from nrccua/feature/make_cross_node_compatible ([155b717](https://github.com/nrccua/apollo-rest-utils/commit/155b717ba0f3bb02f750d40723ab479a9fe81cac)), closes [#12](https://github.com/nrccua/apollo-rest-utils/issues/12) +* [E4E-0]: 1.2.2 ([749db93](https://github.com/nrccua/apollo-rest-utils/commit/749db93999d6d7e9e9840abfcc311061ac700fdd)) +* Merge pull request #11 from nrccua/feature/rest_type_helpers ([d0335a5](https://github.com/nrccua/apollo-rest-utils/commit/d0335a5becaa52a722570103cfd5aed36041b973)), closes [#11](https://github.com/nrccua/apollo-rest-utils/issues/11) + ### [1.2.2](https://github.com/nrccua/apollo-rest-utils/compare/1.2.1...1.2.2) (2021-12-09) diff --git a/lib/generateRoutes/index.test.ts b/lib/generateRoutes/index.test.ts index bdbff7b..ad0718b 100644 --- a/lib/generateRoutes/index.test.ts +++ b/lib/generateRoutes/index.test.ts @@ -43,19 +43,22 @@ describe('generateTypescript', () => { deleteBuildFolder(); }); - it.each(fs.readdirSync(testSwaggerPath).map(d => path.join(testSwaggerPath, d)))('can parse the swagger document %s', async apiPath => { - const api = await SwaggerParser.validate(apiPath); + it.each(fs.readdirSync(testSwaggerPath).map(d => path.join(testSwaggerPath, d)))( + 'can parse the swagger document %s', + async apiPath => { + const api = await SwaggerParser.validate(apiPath); - const typeImport = await generateTypes(apiPath, path.join(buildFolder, `${randomUUID()}_types.ts`)); + const typeImport = await generateTypes(apiPath, path.join(buildFolder, `${randomUUID()}_types.ts`)); - const tsData = generateTypescript(api, typeImport).replace(/apollo-rest-utils/g, '../../lib'); + const tsData = generateTypescript(api, typeImport).replace(/apollo-rest-utils/g, '../../lib'); - expect(tsData).toBeTruthy(); // Not empty, null, or undefined + expect(tsData).toBeTruthy(); // Not empty, null, or undefined - expect(tsData.includes(', endpoint: "')).toBe(false); + expect(tsData.includes(', endpoint: "')).toBe(false); - doTestImport(tsData); - }); + doTestImport(tsData); + }, + ); it('can generate endpoints with the optional endpoint id', async () => { const apiPath = path.join(testSwaggerPath, 'OpenAPIV3WithRef.json'); diff --git a/lib/generateRoutes/index.ts b/lib/generateRoutes/index.ts index 81d73e6..68a8da1 100644 --- a/lib/generateRoutes/index.ts +++ b/lib/generateRoutes/index.ts @@ -12,7 +12,7 @@ import path from 'path'; import SwaggerParser from '@apidevtools/swagger-parser'; import _, { first } from 'lodash'; import { OpenAPI, OpenAPIV3 } from 'openapi-types'; -import openapiTS, { ReferenceObject, ResponseObject, SchemaObject } from 'openapi-typescript'; +import openapiTS, { ParameterObject, ReferenceObject, ResponseObject, SchemaObject } from 'openapi-typescript'; import prettier from 'prettier'; import { RestEndpointSchema } from '../types'; @@ -37,7 +37,11 @@ export function getResponseSchema(properties?: { 'properties' in properties[p] ? { [p]: getResponseSchema((properties[p] as OpenAPIV3.SchemaObject).properties) } // eslint-disable-this-line @typescript-eslint/no-unsafe-assignment : 'items' in properties[p] - ? { [p]: getResponseSchema(((properties[p] as OpenAPIV3.ArraySchemaObject).items as OpenAPIV3.SchemaObject).properties) } + ? { + [p]: getResponseSchema( + ((properties[p] as OpenAPIV3.ArraySchemaObject).items as OpenAPIV3.SchemaObject).properties, + ), + } : p, ) .filter(p => @@ -60,6 +64,36 @@ export function pathToType(endpointPath: string, isArray = false): string { return `${isArray ? '[' : ''}${result.replace(result[0], result[0].toUpperCase())}${isArray ? ']' : ''}`; } +export function typeOfParam(param: ParameterObject): string { + return param.schema && + 'type' in param.schema && + param.schema?.type && + ['number', 'string'].includes(param.schema?.type) + ? param.schema?.type + : 'any'; +} + +export function typeObjectFromParams( + params: (OpenAPIV3.ReferenceObject | OpenAPIV3.ParameterObject)[], +): string | undefined { + if (params.length === 0) { + return undefined; + } + + let typeString = '{ '; + + params.forEach(p => { + const paramObject = p as ParameterObject; + if (paramObject.name) { + typeString += `${_.camelCase(paramObject.name)}: ${typeOfParam(paramObject)}; `; + } + }); + + typeString += ' }'; + + return typeString; +} + export async function generateTypes(apiPath: string, filePath: string): Promise { const typeOutput = await openapiTS(apiPath, { prettierConfig: '.prettierrc.js' }); fs.writeFileSync(filePath, typeOutput); @@ -101,7 +135,9 @@ export function generateTypescript(api: OpenAPI.Document, typeImportLocation: st responseBody += `['content']`; if (responseObject?.content?.['application/json']) { responseBody += `['application/json']`; - schema = responseObject.content['application/json'].schema as OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject; + schema = responseObject.content['application/json'].schema as + | OpenAPIV3.ReferenceObject + | OpenAPIV3.SchemaObject; } } else if ('schema' in responseObject) { responseBody += `['schema']`; @@ -117,16 +153,26 @@ export function generateTypescript(api: OpenAPI.Document, typeImportLocation: st } const requestBodyObject = endpointObject.requestBody as OpenAPIV3.RequestBodyObject; const contentKeys = Object.keys(requestBodyObject?.content ?? {}); + const queryPathParams = + endpointObject.parameters?.filter(p => 'in' in p && ['path', 'query'].includes(p.in)) ?? []; + const queryPathParamsObject = typeObjectFromParams(queryPathParams); const bodyParam = first(endpointObject.parameters?.filter(p => 'name' in p && p.name.toLowerCase() === 'body')); // eslint-disable-next-line no-nested-ternary const requestBody = contentKeys.includes('application/json') ? // OpenAPI 3 way - `paths['${endpointPath}']['${method}']['requestBody']['content']['application/json']` + `paths['${endpointPath}']['${method}']['requestBody']['content']['application/json']${ + queryPathParamsObject ? ` & ${queryPathParamsObject}` : '' + }` : // Swagger 2 way bodyParam - ? `paths['${endpointPath}']['${method}']['parameters']['body']['body']` - : undefined; - const headers = endpointObject.parameters?.filter(p => 'in' in p && p.in === 'header').map(p => p as OpenAPIV3.ParameterObject) ?? []; + ? `paths['${endpointPath}']['${method}']['parameters']['body']['body']${ + queryPathParamsObject ? ` & ${queryPathParamsObject}` : '' + }` + : queryPathParamsObject; + const headers = + endpointObject.parameters + ?.filter(p => 'in' in p && p.in === 'header') + .map(p => p as OpenAPIV3.ParameterObject) ?? []; routes[method as Uppercase][ normalizeName(endpointPath) ] = `${`{ gql: '@rest(method: "${method.toUpperCase()}", path: "${addArgsToPath( @@ -134,11 +180,15 @@ export function generateTypescript(api: OpenAPI.Document, typeImportLocation: st endpointObject.parameters as OpenAPIV3.ParameterObject[] | undefined, )}", type: "${pathToType(endpointPath, isArray)}"${endpointId ? `, endpoint: "${endpointId}"` : ''})', `}${ headers?.length > 0 - ? `headers: [${headers.map(h => JSON.stringify({ description: h.description, name: h.name, required: h.required, schema: h.schema })).join(',\n')}],` + ? `headers: [${headers + .map(h => + JSON.stringify({ description: h.description, name: h.name, required: h.required, schema: h.schema }), + ) + .join(',\n')}],` : '' - }${responseSchema ? `responseSchema: ${JSON.stringify(responseSchema)},\n` : ''}} as IRestEndpoint<${responseBody}${ - requestBody ? `,${requestBody}` : '' - }>,`; + }${ + responseSchema ? `responseSchema: ${JSON.stringify(responseSchema)},\n` : '' + }} as IRestEndpoint<${responseBody}${requestBody ? `,${requestBody}` : ''}>,`; }); }); generatedTSEndpoints += 'const ROUTES = {\n'; diff --git a/lib/useRestQuery/index.test.ts b/lib/useRestQuery/index.test.ts index 32a432e..47ffa21 100644 --- a/lib/useRestQuery/index.test.ts +++ b/lib/useRestQuery/index.test.ts @@ -26,7 +26,10 @@ jest.mock('@apollo/client', () => ({ describe('useRestQuery Library', () => { const useMutationMock = useMutation as jest.Mock; const useQueryMock = useQuery as jest.Mock; - const dummyEndpoint = { gql: '@rest(method: "get", path: "test")' } as IRestEndpoint<{ sessionToken: string }, { testInput: string }>; + const dummyEndpoint = { gql: '@rest(method: "get", path: "test")' } as IRestEndpoint< + { sessionToken: string }, + { testInput: string } + >; beforeEach(() => { jest.resetAllMocks(); @@ -131,7 +134,8 @@ describe('useRestQuery Library', () => { expect(data?.refreshToken.sessionToken).toBe(testToken); // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access - const generatedNode = (first(first(clientMock.query.mock.calls)) as Parameters[0])?.query as DocumentNode; + const generatedNode = (first(first(clientMock.query.mock.calls)) as Parameters[0]) + ?.query as DocumentNode; // Make sure our @rest gql got injected expect(print(generatedNode)).toContain(dummyEndpoint.gql); @@ -139,10 +143,10 @@ describe('useRestQuery Library', () => { }); describe('validateQueryAgainstEndpoint', () => { - const dummyEndpoint = { gql: '@rest(method: "get", path: "test")', responseSchema: ['sessionToken'] } as IRestEndpoint< - { sessionToken: string }, - { testInput: string } - >; + const dummyEndpoint = { + gql: '@rest(method: "get", path: "test")', + responseSchema: ['sessionToken'], + } as IRestEndpoint<{ sessionToken: string }, { testInput: string }>; beforeEach(() => { jest.resetAllMocks(); @@ -180,22 +184,37 @@ describe('validateQueryAgainstEndpoint', () => { it('should throw an error for a query with no definitions', () => { const query = { definitions: [], kind: 'Document' } as DocumentNode; - expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError('Query must contain exactly one definition'); + expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError( + 'Query must contain exactly one definition', + ); }); it('should throw an error for a query with a non-operation definitions', () => { - const query = { definitions: [{ kind: 'ScalarTypeDefinition', name: { kind: 'Name', value: 'NULL' } }], kind: 'Document' } as DocumentNode; + const query = { + definitions: [{ kind: 'ScalarTypeDefinition', name: { kind: 'Name', value: 'NULL' } }], + kind: 'Document', + } as DocumentNode; - expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError('Query definition must be an operation'); + expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError( + 'Query definition must be an operation', + ); }); it('should throw and error with an empty selections array', () => { const query: DocumentNode = { - definitions: [{ kind: 'OperationDefinition', operation: 'query', selectionSet: { kind: 'SelectionSet', selections: [] as readonly SelectionNode[] } }], + definitions: [ + { + kind: 'OperationDefinition', + operation: 'query', + selectionSet: { kind: 'SelectionSet', selections: [] as readonly SelectionNode[] }, + }, + ], kind: 'Document', }; - expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError('Query must contain exactly one selection'); + expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError( + 'Query must contain exactly one selection', + ); }); it('should throw and error with a non-Field selection', () => { @@ -204,7 +223,10 @@ describe('validateQueryAgainstEndpoint', () => { { kind: 'OperationDefinition', operation: 'query', - selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'NULL' } }] as readonly SelectionNode[] }, + selectionSet: { + kind: 'SelectionSet', + selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'NULL' } }] as readonly SelectionNode[], + }, }, ], kind: 'Document', @@ -220,7 +242,9 @@ describe('validateQueryAgainstEndpoint', () => { } `; - expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError('Query selection must contain at least one value to return'); + expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError( + 'Query selection must contain at least one value to return', + ); }); it('should throw an error for a query with a bad field', () => { @@ -232,6 +256,8 @@ describe('validateQueryAgainstEndpoint', () => { } `; - expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError('Query contains invalid fields: test'); + expect(() => validateQueryAgainstEndpoint(query, dummyEndpoint)).toThrowError( + 'Query contains invalid fields: test', + ); }); }); diff --git a/lib/useRestQuery/index.ts b/lib/useRestQuery/index.ts index b7590ad..1fcd578 100644 --- a/lib/useRestQuery/index.ts +++ b/lib/useRestQuery/index.ts @@ -42,7 +42,11 @@ export function validateQueryAgainstEndpoint (s as FieldNode).name.value); - const badFields = subFields.filter(fieldName => endpoint.responseSchema !== undefined && getSchemaField(endpoint.responseSchema, fieldName) === undefined); + const badFields = subFields.filter( + fieldName => + endpoint.responseSchema !== undefined && getSchemaField(endpoint.responseSchema, fieldName) === undefined, + ); if (badFields.length > 0) { - throw new InvalidQueryError(`Query contains invalid fields: ${badFields.join(', ')}`, query, endpoint, endpoint.responseSchema); + throw new InvalidQueryError( + `Query contains invalid fields: ${badFields.join(', ')}`, + query, + endpoint, + endpoint.responseSchema, + ); } } @@ -77,10 +89,12 @@ export function useRestMutation< MutationHookOptions, TVariables, TContext>, ): MutationTuple, TVariables | Input, TContext, TCache> { validateQueryAgainstEndpoint(mutation, options.endpoint); - const directives = (mutation.definitions[0] as OperationDefinitionNode).selectionSet.selections[0].directives as DirectiveNode[]; + const directives = (mutation.definitions[0] as OperationDefinitionNode).selectionSet.selections[0] + .directives as DirectiveNode[]; if (directives.length === 0) { const dummyGQL = gql`query a($c: any) { b(c: $c) ${options.endpoint.gql} {d} }`; - const dummyDirectives = (dummyGQL.definitions[0] as OperationDefinitionNode).selectionSet.selections[0].directives as DirectiveNode[]; + const dummyDirectives = (dummyGQL.definitions[0] as OperationDefinitionNode).selectionSet.selections[0] + .directives as DirectiveNode[]; directives.push(dummyDirectives[0]); } @@ -119,8 +133,13 @@ export function useRestMutation< *` const uid = result.user.uid; // This is properly typed!` */ export function wrapRestMutation() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return = ApolloCache>( + return < + TData = unknown, + TVariables = OperationVariables, + TContext = DefaultContext, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + TCache extends ApolloCache = ApolloCache, + >( mutation: DocumentNode | TypedDocumentNode, options: IEndpointOptions & MutationHookOptions, ): MutationTuple, TVariables | Input, TContext, TCache> => @@ -133,18 +152,24 @@ export function wrapRestMutation() { export function useRestQuery( query: DocumentNode | TypedDocumentNode, TVariables>, - options: IEndpointOptions, TVariables | Input> & QueryHookOptions, TVariables>, + options: IEndpointOptions, TVariables | Input> & + QueryHookOptions, TVariables>, ): QueryResult, TVariables> { validateQueryAgainstEndpoint(query, options.endpoint); - const directives = (query.definitions[0] as OperationDefinitionNode).selectionSet.selections[0].directives as DirectiveNode[]; + const directives = (query.definitions[0] as OperationDefinitionNode).selectionSet.selections[0] + .directives as DirectiveNode[]; if (directives.length === 0) { const dummyGQL = gql`query a($c: any) { b(c: $c) ${options.endpoint.gql} {d} }`; - const dummyDirectives = (dummyGQL.definitions[0] as OperationDefinitionNode).selectionSet.selections[0].directives as DirectiveNode[]; + const dummyDirectives = (dummyGQL.definitions[0] as OperationDefinitionNode).selectionSet.selections[0] + .directives as DirectiveNode[]; directives.push(dummyDirectives[0]); } // eslint-disable-next-line react-hooks/rules-of-hooks - return useQuery, TVariables>(query, options as QueryHookOptions, TVariables>); + return useQuery, TVariables>( + query, + options as QueryHookOptions, TVariables>, + ); } /** @@ -191,10 +216,12 @@ export function useRestClientQuery( QueryOptions> & { client: ApolloClient }, ): Promise>> { validateQueryAgainstEndpoint(options.query, options.endpoint); - const directives = (options.query.definitions[0] as OperationDefinitionNode).selectionSet.selections[0].directives as DirectiveNode[]; + const directives = (options.query.definitions[0] as OperationDefinitionNode).selectionSet.selections[0] + .directives as DirectiveNode[]; if (directives.length === 0) { const dummyGQL = gql`query a($c: any) { b(c: $c) ${options.endpoint.gql} {d} }`; - const dummyDirectives = (dummyGQL.definitions[0] as OperationDefinitionNode).selectionSet.selections[0].directives as DirectiveNode[]; + const dummyDirectives = (dummyGQL.definitions[0] as OperationDefinitionNode).selectionSet.selections[0] + .directives as DirectiveNode[]; directives.push(dummyDirectives[0]); } diff --git a/package-lock.json b/package-lock.json index 3a387fc..2f88a60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "apollo-rest-utils", - "version": "1.2.2", + "version": "1.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1541,23 +1541,21 @@ "from": "git+https://github.com/nrccua/eslint-config.git", "dev": true, "requires": { - "@actinc/eslint-config": "3.3.0", + "@actinc/eslint-config": "3.4.0", "@commitlint/cli": "15.0.0", "@commitlint/config-conventional": "15.0.0", "@typescript-eslint/eslint-plugin": "5.4.0", "@typescript-eslint/parser": "5.4.0", "@typescript-eslint/typescript-estree": "5.4.0", "babel-jest": "27.3.1", - "enzyme": "3.11.0", - "enzyme-to-json": "3.6.2", - "eslint": "8.2.0", - "eslint-config-airbnb": "19.0.0", + "eslint": "8.3.0", + "eslint-config-airbnb": "19.0.1", "eslint-config-airbnb-base": "15.0.0", "eslint-config-prettier": "8.3.0", "eslint-plugin-disable": "2.0.3", "eslint-plugin-filenames": "1.3.2", "eslint-plugin-import": "2.25.3", - "eslint-plugin-jest": "25.2.4", + "eslint-plugin-jest": "25.3.0", "eslint-plugin-jsx-a11y": "6.5.1", "eslint-plugin-lodash": "7.3.0", "eslint-plugin-new-with-error": "3.1.0", @@ -1567,7 +1565,7 @@ "eslint-plugin-react": "7.27.1", "eslint-plugin-react-hooks": "4.3.0", "eslint-plugin-security": "1.4.0", - "markdownlint-cli": "0.29.0", + "markdownlint-cli": "0.30.0", "prettier": "2.4.1", "ts-node": "10.4.0", "typescript": "4.5.2" @@ -2240,15 +2238,6 @@ "@babel/types": "^7.3.0" } }, - "@types/cheerio": { - "version": "0.22.30", - "resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.30.tgz", - "integrity": "sha512-t7ZVArWZlq3dFa9Yt33qFBQIK4CQd1Q3UJp0V+UhP6vgLWLM6Qug7vZuRSGXg45zXeB1Fm5X2vmBkEX58LV2Tw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -2869,19 +2858,6 @@ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, - "array.prototype.filter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.1.tgz", - "integrity": "sha512-Dk3Ty7N42Odk7PjU/Ci3zT4pLj20YvuVnneG/58ICM6bt4Ij5kZaJTVQ9TSaWaIECX2sFyz4KItkVZqHNnciqw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.7" - } - }, "array.prototype.flat": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", @@ -3049,12 +3025,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", - "dev": true - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -3174,42 +3144,6 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, - "cheerio": { - "version": "1.0.0-rc.10", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", - "integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", - "dev": true, - "requires": { - "cheerio-select": "^1.5.0", - "dom-serializer": "^1.3.2", - "domhandler": "^4.2.0", - "htmlparser2": "^6.1.0", - "parse5": "^6.0.1", - "parse5-htmlparser2-tree-adapter": "^6.0.1", - "tslib": "^2.2.0" - }, - "dependencies": { - "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", - "dev": true - } - } - }, - "cheerio-select": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", - "integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", - "dev": true, - "requires": { - "css-select": "^4.1.3", - "css-what": "^5.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0", - "domutils": "^2.7.0" - } - }, "ci-info": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", @@ -3724,25 +3658,6 @@ "which": "^2.0.1" } }, - "css-select": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.1.3.tgz", - "integrity": "sha512-gT3wBNd9Nj49rAbmtFHj1cljIAOLYSX1nZ8CB7TBO3INYckygm5B7LISU/szY//YmdiSLbJvDLOx9VnMVpMBxA==", - "dev": true, - "requires": { - "boolbase": "^1.0.0", - "css-what": "^5.0.0", - "domhandler": "^4.2.0", - "domutils": "^2.6.0", - "nth-check": "^2.0.0" - } - }, - "css-what": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", - "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==", - "dev": true - }, "cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -3937,12 +3852,6 @@ "path-type": "^4.0.0" } }, - "discontinuous-range": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=", - "dev": true - }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -3952,23 +3861,6 @@ "esutils": "^2.0.2" } }, - "dom-serializer": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", - "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - } - }, - "domelementtype": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", - "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", - "dev": true - }, "domexception": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz", @@ -3986,26 +3878,6 @@ } } }, - "domhandler": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.2.tgz", - "integrity": "sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w==", - "dev": true, - "requires": { - "domelementtype": "^2.2.0" - } - }, - "domutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", - "dev": true, - "requires": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - } - }, "dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -4094,57 +3966,6 @@ "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", "dev": true }, - "enzyme": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz", - "integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==", - "dev": true, - "requires": { - "array.prototype.flat": "^1.2.3", - "cheerio": "^1.0.0-rc.3", - "enzyme-shallow-equal": "^1.0.1", - "function.prototype.name": "^1.1.2", - "has": "^1.0.3", - "html-element-map": "^1.2.0", - "is-boolean-object": "^1.0.1", - "is-callable": "^1.1.5", - "is-number-object": "^1.0.4", - "is-regex": "^1.0.5", - "is-string": "^1.0.5", - "is-subset": "^0.1.1", - "lodash.escape": "^4.0.1", - "lodash.isequal": "^4.5.0", - "object-inspect": "^1.7.0", - "object-is": "^1.0.2", - "object.assign": "^4.1.0", - "object.entries": "^1.1.1", - "object.values": "^1.1.1", - "raf": "^3.4.1", - "rst-selector-parser": "^2.2.3", - "string.prototype.trim": "^1.2.1" - } - }, - "enzyme-shallow-equal": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.4.tgz", - "integrity": "sha512-MttIwB8kKxypwHvRynuC3ahyNc+cFbR8mjVIltnmzQ0uKGqmsfO4bfBuLxb0beLNPhjblUEYvEbsg+VSygvF1Q==", - "dev": true, - "requires": { - "has": "^1.0.3", - "object-is": "^1.1.2" - } - }, - "enzyme-to-json": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/enzyme-to-json/-/enzyme-to-json-3.6.2.tgz", - "integrity": "sha512-Ynm6Z6R6iwQ0g2g1YToz6DWhxVnt8Dy1ijR2zynRKxTyBGA8rCDXU3rs2Qc4OKvUvc2Qoe1bcFK6bnPs20TrTg==", - "dev": true, - "requires": { - "@types/cheerio": "^0.22.22", - "lodash": "^4.17.21", - "react-is": "^16.12.0" - } - }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -4181,12 +4002,6 @@ "unbox-primitive": "^1.0.1" } }, - "es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "dev": true - }, "es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -5180,30 +4995,12 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, - "function.prototype.name": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", - "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "functions-have-names": "^1.2.2" - } - }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "functions-have-names": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.2.tgz", - "integrity": "sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA==", - "dev": true - }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -5545,16 +5342,6 @@ "lru-cache": "^6.0.0" } }, - "html-element-map": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.3.1.tgz", - "integrity": "sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==", - "dev": true, - "requires": { - "array.prototype.filter": "^1.0.0", - "call-bind": "^1.0.2" - } - }, "html-encoding-sniffer": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", @@ -5570,18 +5357,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "htmlparser2": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", - "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "domutils": "^2.5.2", - "entities": "^2.0.0" - } - }, "http-proxy-agent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", @@ -5882,12 +5657,6 @@ "has-tostringtag": "^1.0.0" } }, - "is-subset": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", - "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", - "dev": true - }, "is-symbol": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", @@ -6975,24 +6744,12 @@ "integrity": "sha1-uvr7yRi1UVTheRdqALsK76rIVLc=", "dev": true }, - "lodash.escape": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", - "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", - "dev": true - }, "lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", "dev": true }, - "lodash.flattendeep": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", - "dev": true - }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -7322,12 +7079,6 @@ "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true }, - "moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==", - "dev": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -7340,26 +7091,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "nearley": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", - "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", - "dev": true, - "requires": { - "commander": "^2.19.0", - "moo": "^0.5.0", - "railroad-diagrams": "^1.0.0", - "randexp": "0.4.6" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - } - } - }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -7608,15 +7339,6 @@ "path-key": "^3.0.0" } }, - "nth-check": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", - "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", - "dev": true, - "requires": { - "boolbase": "^1.0.0" - } - }, "null-check": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz", @@ -7639,16 +7361,6 @@ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==" }, - "object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -7866,15 +7578,6 @@ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", "dev": true }, - "parse5-htmlparser2-tree-adapter": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", - "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", - "dev": true, - "requires": { - "parse5": "^6.0.1" - } - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -7903,12 +7606,6 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -8117,31 +7814,6 @@ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==" }, - "raf": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", - "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", - "dev": true, - "requires": { - "performance-now": "^2.1.0" - } - }, - "railroad-diagrams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=", - "dev": true - }, - "randexp": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", - "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", - "dev": true, - "requires": { - "discontinuous-range": "1.0.0", - "ret": "~0.1.10" - } - }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -8347,16 +8019,6 @@ "glob": "^7.1.3" } }, - "rst-selector-parser": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", - "integrity": "sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=", - "dev": true, - "requires": { - "lodash.flattendeep": "^4.4.0", - "nearley": "^2.7.10" - } - }, "run-con": { "version": "1.2.10", "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.10.tgz", @@ -8734,17 +8396,6 @@ "es-abstract": "^1.19.1" } }, - "string.prototype.trim": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.5.tgz", - "integrity": "sha512-Lnh17webJVsD6ECeovpVN17RlAKjmz4rF9S+8Y45CkMc/ufVpTkU3vZIyIC7sllQ1FCvObZnnCdNs/HXTUOTlg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - } - }, "string.prototype.trimend": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", diff --git a/package.json b/package.json index 033e2fd..51f5e91 100644 --- a/package.json +++ b/package.json @@ -69,5 +69,5 @@ "update:version:major": "standard-version --release-as major", "update:version:minor": "standard-version --release-as minor" }, - "version": "1.2.2" + "version": "1.3.0" } diff --git a/test/test_data/generateRoutes/OpenAPIV3NoRef.json b/test/test_data/generateRoutes/OpenAPIV3NoRef.json index b1dcc00..625d53a 100644 --- a/test/test_data/generateRoutes/OpenAPIV3NoRef.json +++ b/test/test_data/generateRoutes/OpenAPIV3NoRef.json @@ -78,11 +78,7 @@ ], "summary": "Authenticates a user", "operationId": "login", - "security": [ - { - "AWS": [] - } - ], + "security": [], "requestBody": { "required": true, "description": "email and password to be used in the authentication process. If acceptedTerms is set to true, it will update user's terms attribute", @@ -451,11 +447,7 @@ "summary": "Activate user", "operationId": "activateUser", "description": "Verifies user e-mail and if e-mail is valid, activate user and set userName and password as provided on body.", - "security": [ - { - "AWS": [] - } - ], + "security": [], "requestBody": { "required": true, "description": "Body contains the user e-mail to be verified and the verificationCode, which corresponds to the authToken \n in the user model; the userName to be set; the password; and user uid", @@ -811,11 +803,7 @@ "summary": "Send forgot password e-mail", "operationId": "forgotPassword", "description": "Requests a password change. An e-mail with instructions on how to change the password will be sent to the configured user e-mail.", - "security": [ - { - "AWS": [] - } - ], + "security": [], "requestBody": { "required": true, "description": "Body should have the e-mail or userName of the user that forgot his password", @@ -871,9 +859,6 @@ "operationId": "resetPassword", "description": "Changes user password to a new password provided in the request body.", "security": [ - { - "AWS": [] - }, { "JWT": [] } @@ -957,11 +942,7 @@ "summary": "Refresh JWT", "operationId": "refreshJWT", "description": "Return a new Json Web Token with a refreshed expiration time.", - "security": [ - { - "AWS": [] - } - ], + "security": [], "responses": { "200": { "description": "JWT successfully refreshed", @@ -998,11 +979,7 @@ "summary": "Check authorization to module", "operationId": "checkModuleAuthorization", "description": "Check authorization to module by moduleIdentifier (it could be both uid or key).", - "security": [ - { - "AWS": [] - } - ], + "security": [], "parameters": [ { "name": "moduleIdentifier", @@ -1157,11 +1134,7 @@ "summary": "Validate Email", "operationId": "validateEmail", "description": "Return a flag indicating if e-mails is valid (not used yet) or invalid.", - "security": [ - { - "AWS": [] - } - ], + "security": [], "requestBody": { "required": true, "description": "Body must contain the e-mail to be validated, in other words, an e-mail that uniqueness will be verified.", @@ -1234,9 +1207,6 @@ "operationId": "identifyEmail", "description": "Identify whether the email exists in UMS (`existing`) and is supported (`supported`) by Encourage. DataLab users are not supported.", "security": [ - { - "AWS": [] - }, { "JWT": [] } @@ -1326,11 +1296,7 @@ "summary": "Validate Username", "operationId": "validateUsername", "description": "Return flags indicating if username is valid (not used yet) or invalid.", - "security": [ - { - "AWS": [] - } - ], + "security": [], "requestBody": { "required": true, "description": "Body must contain the username to be validated.", @@ -4010,11 +3976,7 @@ "summary": "Submits a new user support ticket", "description": "Sends an email to support, containing related high school and user data", "operationId": "userSignup", - "security": [ - { - "AWS": [] - } - ], + "security": [], "requestBody": { "required": true, "content": { @@ -4114,14 +4076,14 @@ } } }, - "/users/{uid}/activate": { - "post": { + "/users/{uid}/attributes": { + "put": { "tags": [ "User" ], - "summary": "Activate Educator", - "description": "Activate an educator account", - "operationId": "activateEducator", + "summary": "Updates an Encourage User's UMS attributes", + "description": "Updates a user/'s attributes in UMS, identified by UID. Parameters to be updated are provided in the requested body and correspond to the \n fields described in attributes model. Attributes in the payload must be a non-empty array.", + "operationId": "updateUserAttributes", "parameters": [ { "name": "uid", @@ -4138,108 +4100,26 @@ "content": { "application/json": { "schema": { - "type": "object", - "required": [ - "acceptedTerms", - "contactId", - "password", - "email" - ], - "properties": { - "firstName": { - "type": "string", - "example": "testUserFirstName" - }, - "lastName": { - "type": "string", - "example": "testUserLastName" - }, - "acceptedTerms": { - "type": "boolean" - }, - "contactId": { - "type": "string", - "example": "HC123456" - }, - "password": { - "type": "string", - "example": "P@ssw0rd" - }, - "email": { - "type": "string", - "example": "test@email.com" + "type": "array", + "items": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string", + "example": "tempore" + }, + "value": { + "type": "object" + } } } } } } }, - "responses": { - "204": { - "description": "No Content" - }, - "400": { - "description": "Bad Request" - }, - "403": { - "description": "Forbidden" - }, - "404": { - "description": "Not Found" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/users/{uid}/setup-mco-user": { - "post": { - "tags": [ - "User" - ], - "summary": "Sets up the Encourage User's MCO data from a UMS user.", - "description": "[LDAP ONLY] An Encourage user is composed by multiple parts, one of them being in MCO. This uses existing UMS data to set up\n the MCO part of a user in AWS DB and EncourageDB.\n One use case for this is finishing users that have been created from the Migrator Lambdas or directly in UMS.", - "operationId": "setupMcoUser", - "parameters": [ - { - "name": "uid", - "in": "path", - "description": "Unique identifier in UMS", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "firstName": { - "type": "string", - "example": "testUserFirstName" - }, - "lastName": { - "type": "string", - "example": "testUserLastName" - }, - "prefix": { - "type": "string", - "example": "Mr." - } - }, - "required": [ - "firstName", - "lastName" - ] - } - } - } - }, "responses": { "200": { "description": "OK", @@ -4570,14 +4450,14 @@ } } }, - "/users/{uid}/pre-activate-educator": { + "/users/{uid}/activate": { "post": { "tags": [ "User" ], - "summary": "Pre-activate Educator users coming from the Migrator lambdas and assign them a random password.", - "description": "[LDAP ONLY] For a user that has been created from the Migrator Lambdas or directly in UMS, and is Pending,\n this route will do the following:
\n - set up the user as Active and with terms accepted in UMS
\n - define a random generated password", - "operationId": "preActivateEducator", + "summary": "Activate Educator", + "description": "Activate an educator account", + "operationId": "activateEducator", "parameters": [ { "name": "uid", @@ -4589,6 +4469,47 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "acceptedTerms", + "contactId", + "password", + "email" + ], + "properties": { + "firstName": { + "type": "string", + "example": "testUserFirstName" + }, + "lastName": { + "type": "string", + "example": "testUserLastName" + }, + "acceptedTerms": { + "type": "boolean" + }, + "contactId": { + "type": "string", + "example": "HC123456" + }, + "password": { + "type": "string", + "example": "P@ssw0rd" + }, + "email": { + "type": "string", + "example": "test@email.com" + } + } + } + } + } + }, "responses": { "204": { "description": "No Content" @@ -4596,26 +4517,6 @@ "400": { "description": "Bad Request" }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { - "type": "number", - "example": 401 - }, - "message": { - "type": "string", - "example": "jwt expired" - } - } - } - } - } - }, "403": { "description": "Forbidden" }, @@ -4624,52 +4525,487 @@ }, "500": { "description": "Internal Server Error" - }, - "504": { - "description": "Gateway Timeout" } } } }, - "/users/contact/{contact_id}": { - "get": { + "/users/{uid}/setup-mco-user": { + "post": { "tags": [ "User" ], - "summary": "Get a User's status by contact id", - "description": "Returns a user's status and email given its contact_id external Id", - "operationId": "getUserStatusByContactId", + "summary": "Sets up the Encourage User's MCO data from a UMS user.", + "description": "[LDAP ONLY] An Encourage user is composed by multiple parts, one of them being in MCO. This uses existing UMS data to set up\n the MCO part of a user in AWS DB and EncourageDB.\n One use case for this is finishing users that have been created from the Migrator Lambdas or directly in UMS.", + "operationId": "setupMcoUser", "parameters": [ { - "name": "contact_id", + "name": "uid", "in": "path", - "description": "The external ID, contact_id, of the educator contact", + "description": "Unique identifier in UMS", "required": true, "schema": { "type": "string" } } ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { - "type": "string", - "example": "Active", - "enum": [ - "Active", - "Inactive", - "Pending", - "Disabled" - ] - }, - "email": { - "type": "string", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "firstName": { + "type": "string", + "example": "testUserFirstName" + }, + "lastName": { + "type": "string", + "example": "testUserLastName" + }, + "prefix": { + "type": "string", + "example": "Mr." + } + }, + "required": [ + "firstName", + "lastName" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "example": "1e6c6d8e-af30-43ca-a519-395734701eba" + }, + "type": { + "type": "string", + "example": "User", + "default": "User", + "enum": [ + "LdapUser", + "Role", + "User" + ] + }, + "firstName": { + "type": "string", + "example": "testUserFirstName" + }, + "lastName": { + "type": "string", + "example": "testUserLastName" + }, + "userName": { + "type": "string", + "example": "testUserName" + }, + "status": { + "type": "string", + "example": "Active", + "enum": [ + "Active", + "Inactive", + "Pending", + "Disabled" + ] + }, + "email": { + "type": "string", + "format": "email", + "example": "test@user.mail" + }, + "verifiedDate": { + "type": "string", + "format": "date-time", + "example": "2019-01-07T18:29:25.493Z" + }, + "createdAt": { + "type": "string", + "format": "date-time", + "example": "2019-01-07T18:29:25.493Z" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2019-01-07T18:29:25.493Z" + }, + "externalIds": { + "type": "array", + "items": { + "type": "object", + "required": [ + "uid", + "userUid", + "source", + "externalId" + ], + "properties": { + "uid": { + "type": "string", + "example": "aaaa-bbbbb-ccccc-ddddd", + "description": "UMS unique identifier for the external ID entity" + }, + "userUid": { + "type": "string", + "example": "82596c17-2e90-4321-8f67-c16e4a4ae646" + }, + "organizationUid": { + "type": "string", + "example": "a80585ee-7e81-4d7c-8a75-4c2293243703", + "description": "Optional property if the external ID for the user is related to an org" + }, + "source": { + "type": "string", + "example": "contact_id" + }, + "externalId": { + "type": "string", + "example": "HCSXFXYZ" + } + } + } + }, + "creator": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "example": "1e6c6d8e-af30-43ca-a519-395734701eba" + }, + "firstName": { + "type": "string", + "example": "testUserFirstName" + }, + "lastName": { + "type": "string", + "example": "testUserLastName" + } + } + }, + "versionWarning": { + "type": "boolean", + "example": "false", + "default": "false" + }, + "application": { + "type": "object", + "properties": { + "modules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "key": { + "type": "string" + }, + "permissionOverwrite": { + "type": "boolean" + }, + "attributesOverwrite": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string", + "example": "tempore" + }, + "value": { + "type": "object" + } + } + } + } + } + }, + "key": { + "type": "string", + "example": "Encourage" + } + } + }, + "organizations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "example": "2e6dba3f-4916-469d-bb6e-01d2c67b2211" + }, + "type": { + "type": "string", + "enum": [ + "Organization", + "OrgType" + ] + }, + "name": { + "type": "string", + "example": "NitzscheandSons" + }, + "status": { + "type": "string", + "enum": [ + "Active", + "Inactive", + "Pending" + ], + "example": "Pending" + }, + "sfAccountId": { + "type": "string", + "example": "0016000000ImzzJAAR" + }, + "externalId": { + "type": "string", + "example": "003422" + }, + "actCode": { + "type": "string", + "example": "0011" + }, + "createdAt": { + "type": "string", + "format": "date-time", + "example": "2017-06-21T16:36:08.039Z" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "example": "2017-06-21T16:36:08.039Z" + }, + "programs": { + "type": "array", + "items": {} + }, + "group": {}, + "parent": {}, + "creator": {}, + "users": { + "type": "array", + "items": {} + }, + "applications": { + "type": "array", + "items": {} + }, + "attributes": { + "type": "array", + "items": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string", + "example": "tempore" + }, + "value": { + "type": "object" + } + } + } + } + } + } + }, + "roles": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "example": "bf45a23c-b527-4c5d-b7b8-60250339d265" + }, + "roleName": { + "type": "string", + "example": "Administrator" + } + } + } + }, + "attributes": { + "type": "array", + "items": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string", + "example": "tempore" + }, + "value": { + "type": "object" + } + } + } + } + } + } + } + } + }, + "400": { + "description": "Bad Request" + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "number", + "example": 401 + }, + "message": { + "type": "string", + "example": "jwt expired" + } + } + } + } + } + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + }, + "504": { + "description": "Gateway Timeout" + } + } + } + }, + "/users/{uid}/pre-activate-educator": { + "post": { + "tags": [ + "User" + ], + "summary": "Pre-activate Educator users coming from the Migrator lambdas and assign them a random password.", + "description": "[LDAP ONLY] For a user that has been created from the Migrator Lambdas or directly in UMS, and is Pending,\n this route will do the following:
\n - set up the user as Active and with terms accepted in UMS
\n - define a random generated password", + "operationId": "preActivateEducator", + "parameters": [ + { + "name": "uid", + "in": "path", + "description": "Unique identifier in UMS", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request" + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "number", + "example": 401 + }, + "message": { + "type": "string", + "example": "jwt expired" + } + } + } + } + } + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + }, + "504": { + "description": "Gateway Timeout" + } + } + } + }, + "/users/contact/{contactId}": { + "get": { + "tags": [ + "User" + ], + "summary": "Get a User's status by contact id", + "description": "Returns a user's status and email given its contact_id external Id", + "operationId": "getUserStatusByContactId", + "parameters": [ + { + "name": "contactId", + "in": "path", + "description": "The external ID, contact_id, of the educator contact", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "Active", + "enum": [ + "Active", + "Inactive", + "Pending", + "Disabled" + ] + }, + "email": { + "type": "string", "format": "email", "example": "test@user.mail" } @@ -4687,7 +5023,7 @@ } } }, - "/users/contact/{contact_id}/generate-code": { + "/users/contact/{contactId}/generate-code": { "post": { "tags": [ "User" @@ -4697,7 +5033,7 @@ "operationId": "generateCode", "parameters": [ { - "name": "contact_id", + "name": "contactId", "in": "path", "description": "The external ID, contact_id, of the educator contact", "required": true, @@ -4728,7 +5064,7 @@ } } }, - "/users/contact/{contact_id}/validate-code": { + "/users/contact/{contactId}/validate-code": { "post": { "tags": [ "User" @@ -4738,7 +5074,7 @@ "operationId": "validateCode", "parameters": [ { - "name": "contact_id", + "name": "contactId", "in": "path", "description": "The external ID, contact_id, of the educator contact", "required": true, @@ -5604,211 +5940,214 @@ } } } - } - }, - "userSchool": { - "type": "object", - "properties": { - "student_key": { - "type": "string", - "example": "102482975" - }, - "school_id": { - "type": "integer", - "example": 1 - }, - "application_status_key": { - "type": "string", - "enum": [ - "INITIAL", - "APPLYING_0", - "APPLYING_25", - "APPLYING_50", - "APPLYING_75", - "APPLIED", - "ACCEPTED", - "NOT_ACCEPTED", - "ENROLLING", - "NOT_ENROLLING", - "DEFERRED_WAITLISTED" - ] - }, - "update_increment": { - "type": "integer", - "example": 1 - }, - "is_bookmarked": { - "type": "boolean", - "example": true - }, - "is_declared": { - "type": "boolean", - "example": true - }, - "is_quickmatch": { - "type": "boolean", - "example": false - }, - "is_aos": { - "type": "boolean", - "example": false - }, - "application_status": { - "type": "string", - "example": "applying" - }, - "applying_percent": { - "type": "integer", - "example": 75 - }, - "school": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "CollegeName" - }, - "nickname": { - "type": "string", - "example": "CollegeNickname" - }, - "fice": { - "type": "string", - "example": "1525134" - }, - "ug_inst_id": { - "type": "string", - "example": "collegeinsta" - }, - "ipeds_id": { - "type": "string", - "default": "234525" - }, - "address_1": { - "type": "string", - "default": "CollegeAddress1" - }, - "address_2": { - "type": "string", - "default": "CollegeAddress2" - }, - "city": { - "type": "string", - "default": "CollegeCity" - }, - "state": { - "type": "string", - "default": "CS" - }, - "zip": { - "type": "string", - "default": "12345" - }, - "country": { - "type": "string", - "default": "CollegeCountry" - }, - "urls": { - "type": "array", - "items": { + } + }, + "user_schools": { + "type": "array", + "items": { + "type": "object", + "properties": { + "student_key": { + "type": "string", + "example": "102482975" + }, + "school_id": { + "type": "integer", + "example": 1 + }, + "application_status_key": { + "type": "string", + "enum": [ + "INITIAL", + "APPLYING_0", + "APPLYING_25", + "APPLYING_50", + "APPLYING_75", + "APPLIED", + "ACCEPTED", + "NOT_ACCEPTED", + "ENROLLING", + "NOT_ENROLLING", + "DEFERRED_WAITLISTED" + ] + }, + "update_increment": { + "type": "integer", + "example": 1 + }, + "is_bookmarked": { + "type": "boolean", + "example": true + }, + "is_declared": { + "type": "boolean", + "example": true + }, + "is_quickmatch": { + "type": "boolean", + "example": false + }, + "is_aos": { + "type": "boolean", + "example": false + }, + "application_status": { + "type": "string", + "example": "applying" + }, + "applying_percent": { + "type": "integer", + "example": 75 + }, + "school": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "CollegeName" + }, + "nickname": { + "type": "string", + "example": "CollegeNickname" + }, + "fice": { + "type": "string", + "example": "1525134" + }, + "ug_inst_id": { + "type": "string", + "example": "collegeinsta" + }, + "ipeds_id": { + "type": "string", + "default": "234525" + }, + "address_1": { + "type": "string", + "default": "CollegeAddress1" + }, + "address_2": { + "type": "string", + "default": "CollegeAddress2" + }, + "city": { + "type": "string", + "default": "CollegeCity" + }, + "state": { + "type": "string", + "default": "CS" + }, + "zip": { + "type": "string", + "default": "12345" + }, + "country": { + "type": "string", + "default": "CollegeCountry" + }, + "urls": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "M", + "I", + "S", + "A", + "B" + ] + }, + "value": { + "type": "string", + "example": "www.example.com" + }, + "type_desc": { + "type": "string", + "enum": [ + "Main", + "Inquiry", + "Schedule Visit", + "Apply", + "Admissions Blog" + ] + } + } + } + }, + "has_campus_image_1x1": { + "type": "boolean" + }, + "has_campus_image_16x9": { + "type": "boolean" + }, + "slug_name": { + "type": "string", + "example": "test-university-1" + }, + "images": { "type": "object", "properties": { - "type": { + "logo": { "type": "string", - "enum": [ - "M", - "I", - "S", - "A", - "B" - ] + "format": "uri", + "example": "https://www.test.com/logo.png" }, - "value": { + "1x1_320": { "type": "string", - "example": "www.example.com" + "format": "uri", + "example": "https://www.test.com/image.jpg" }, - "type_desc": { + "1x1_640": { "type": "string", - "enum": [ - "Main", - "Inquiry", - "Schedule Visit", - "Apply", - "Admissions Blog" - ] + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "1x1_1076": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "1x1_1500": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "1x1_2048": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "16x9_320": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "16x9_640": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "16x9_1076": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "16x9_1500": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" + }, + "16x9_2048": { + "type": "string", + "format": "uri", + "example": "https://www.test.com/image.jpg" } } } - }, - "has_campus_image_1x1": { - "type": "boolean" - }, - "has_campus_image_16x9": { - "type": "boolean" - }, - "slug_name": { - "type": "string", - "example": "test-university-1" - }, - "images": { - "type": "object", - "properties": { - "logo": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/logo.png" - }, - "1x1_320": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "1x1_640": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "1x1_1076": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "1x1_1500": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "1x1_2048": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "16x9_320": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "16x9_640": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "16x9_1076": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "16x9_1500": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - }, - "16x9_2048": { - "type": "string", - "format": "uri", - "example": "https://www.test.com/image.jpg" - } - } } } } @@ -6025,7 +6364,7 @@ } } }, - "/students/{key}": { + "/students/{studentKey}": { "get": { "tags": [ "Student" @@ -6263,7 +6602,7 @@ } } }, - "/students/{key}/application-management": { + "/students/{studentkey}/application-management": { "get": { "tags": [ "Student" @@ -6592,7 +6931,7 @@ } } }, - "/students/{key}/checklist": { + "/students/{studentkey}/checklist": { "get": { "tags": [ "Student" @@ -6753,7 +7092,7 @@ } } }, - "/students/{key}/test-scores": { + "/students/{studentkey}/test-scores": { "get": { "tags": [ "Student" @@ -6982,7 +7321,7 @@ } } }, - "/students/{key}/survey-answers": { + "/students/{studentkey}/survey-answers": { "get": { "tags": [ "Student" @@ -7110,7 +7449,7 @@ } } }, - "/students/{key}/application-status": { + "/students/{studentkey}/application-status": { "get": { "tags": [ "Student" @@ -7396,7 +7735,7 @@ } } }, - "/students/{key}/colleges": { + "/students/{studentkey}/colleges": { "get": { "tags": [ "Student" @@ -7894,7 +8233,7 @@ } } }, - "/students/{key}/scholarships": { + "/students/{studentkey}/scholarships": { "get": { "tags": [ "Student" @@ -8013,7 +8352,7 @@ } } }, - "/students/{key}/colleges/{collegeFice}/credentials": { + "/students/{studentkey}/colleges/{collegeFice}/credentials": { "post": { "tags": [ "Credentials" @@ -8298,7 +8637,7 @@ } } }, - "/students/{key}/credentials/{credUid}": { + "/students/{studentkey}/credentials/{credUid}": { "post": { "tags": [ "Credentials" @@ -8437,7 +8776,7 @@ } } }, - "/students/{key}/external-credentials/colleges/{collegeId}": { + "/students/{studentkey}/external-credentials/colleges/{collegeId}": { "put": { "tags": [ "External Credentials" @@ -8811,6 +9150,67 @@ "example": "11222" } } + }, + "permissions": { + "type": "object", + "properties": { + "reportACTE": { + "type": "boolean", + "example": true + }, + "reportACTFL": { + "type": "boolean", + "example": true + }, + "reportCOF": { + "type": "boolean", + "example": true + }, + "reportDECA": { + "type": "boolean", + "example": true + }, + "reportFBLA": { + "type": "boolean", + "example": true + }, + "reportFCCLA": { + "type": "boolean", + "example": true + }, + "reportMAA": { + "type": "boolean", + "example": true + }, + "reportMCO": { + "type": "boolean", + "example": true + }, + "reportNABSE": { + "type": "boolean", + "example": true + }, + "reportNAFME": { + "type": "boolean", + "example": true + }, + "reportNCSS": { + "type": "boolean", + "example": true + }, + "reportSHAPE": { + "type": "boolean", + "example": true + }, + "reportSTEM": { + "type": "boolean", + "example": true + }, + "reportSUPERINTENDENT": { + "type": "boolean", + "example": true + } + } } } } @@ -9194,6 +9594,65 @@ } } } + }, + "attributes": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "number" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "object", + "properties": { + "value": { + "type": "boolean" + }, + "at": { + "type": "number" + } + } + } + } + } + ] + } } } }, @@ -9232,6 +9691,46 @@ "createdAt": { "type": "string", "example": "2020-06-19T14:29:37.492Z" + }, + "attributes": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "number" + } + } + } + ] + } } } } @@ -12674,6 +13173,217 @@ } } } + }, + "/report/users": { + "get": { + "tags": [ + "Reports" + ], + "summary": "Get all active encourage users report", + "operationId": "reportUsers", + "description": "Gets detailed list of active UMS users who are using encourage", + "parameters": [ + { + "name": "Cache-Control", + "in": "header", + "description": "Informs the service that it should skip cache reading (no-cache), writing (no-store) or both in this request", + "schema": { + "type": "string", + "enum": [ + "no-cache", + "no-store", + "no-cache no-store" + ] + } + }, + { + "in": "query", + "name": "limit", + "schema": { + "type": "integer", + "default": 100, + "minimum": 1 + }, + "required": false, + "description": "Size limit for returned array" + }, + { + "in": "query", + "name": "offset", + "schema": { + "type": "integer", + "default": 0, + "minimum": 0 + }, + "required": false, + "description": "Offset for the data to be returned" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "users": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "email": { + "type": "string" + }, + "status": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "string" + }, + "attribute": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "key", + "value" + ] + } + }, + "application": { + "type": "string", + "nullable": true + }, + "organizations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string", + "nullable": true + }, + "hsId": { + "type": "string", + "nullable": true + }, + "contactId": { + "type": "string", + "nullable": true + } + }, + "required": [ + "uid", + "name" + ] + } + }, + "modules": { + "type": "array", + "items": { + "type": "string" + } + }, + "verifiedDate": { + "type": "string", + "format": "date-time" + }, + "lastLoginDate": { + "type": "string", + "format": "date-time" + } + } + }, + "required": [ + "uid", + "firstName", + "lastName", + "email", + "status", + "createdAt", + "createdBy", + "attributes", + "organizations", + "modules", + "verifiedDate" + ] + }, + "total": { + "type": "integer" + } + }, + "required": [ + "properties", + "total" + ] + } + } + }, + "headers": { + "Expires": { + "schema": { + "type": "string" + }, + "description": "The expiration date for a given requested resource, only when obtained from the cache" + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "number", + "example": 401 + }, + "message": { + "type": "string", + "example": "jwt expired" + } + } + } + } + } + }, + "403": { + "description": "Forbidden" + }, + "500": { + "description": "Internal Server Error" + } + } + } } }, "components": { @@ -16584,6 +17294,65 @@ } } } + }, + "attributes": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "number" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "object", + "properties": { + "value": { + "type": "boolean" + }, + "at": { + "type": "number" + } + } + } + } + } + ] + } } } }, @@ -16622,6 +17391,46 @@ "createdAt": { "type": "string", "example": "2020-06-19T14:29:37.492Z" + }, + "attributes": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "number" + } + } + } + ] + } } } }, @@ -16738,6 +17547,65 @@ } } } + }, + "attributes": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "number" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "object", + "properties": { + "value": { + "type": "boolean" + }, + "at": { + "type": "number" + } + } + } + } + } + ] + } } } }, @@ -16776,6 +17644,46 @@ "createdAt": { "type": "string", "example": "2020-06-19T14:29:37.492Z" + }, + "attributes": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "number" + } + } + } + ] + } } } } @@ -17106,6 +18014,67 @@ } } }, + "secondarySchoolReportPermissions": { + "type": "object", + "properties": { + "reportACTE": { + "type": "boolean", + "example": true + }, + "reportACTFL": { + "type": "boolean", + "example": true + }, + "reportCOF": { + "type": "boolean", + "example": true + }, + "reportDECA": { + "type": "boolean", + "example": true + }, + "reportFBLA": { + "type": "boolean", + "example": true + }, + "reportFCCLA": { + "type": "boolean", + "example": true + }, + "reportMAA": { + "type": "boolean", + "example": true + }, + "reportMCO": { + "type": "boolean", + "example": true + }, + "reportNABSE": { + "type": "boolean", + "example": true + }, + "reportNAFME": { + "type": "boolean", + "example": true + }, + "reportNCSS": { + "type": "boolean", + "example": true + }, + "reportSHAPE": { + "type": "boolean", + "example": true + }, + "reportSTEM": { + "type": "boolean", + "example": true + }, + "reportSUPERINTENDENT": { + "type": "boolean", + "example": true + } + } + }, "credential": { "type": "object", "properties": { @@ -17450,6 +18419,127 @@ } } }, + "reportUser": { + "type": "object", + "properties": { + "users": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "email": { + "type": "string" + }, + "status": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "string" + }, + "attribute": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "key", + "value" + ] + } + }, + "application": { + "type": "string", + "nullable": true + }, + "organizations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string", + "nullable": true + }, + "hsId": { + "type": "string", + "nullable": true + }, + "contactId": { + "type": "string", + "nullable": true + } + }, + "required": [ + "uid", + "name" + ] + } + }, + "modules": { + "type": "array", + "items": { + "type": "string" + } + }, + "verifiedDate": { + "type": "string", + "format": "date-time" + }, + "lastLoginDate": { + "type": "string", + "format": "date-time" + } + } + }, + "required": [ + "uid", + "firstName", + "lastName", + "email", + "status", + "createdAt", + "createdBy", + "attributes", + "organizations", + "modules", + "verifiedDate" + ] + }, + "total": { + "type": "integer" + } + }, + "required": [ + "properties", + "total" + ] + }, "unauthorized": { "type": "object", "properties": { @@ -17557,6 +18647,17 @@ "required": false, "description": "Size limit for returned array" }, + "limit100": { + "in": "query", + "name": "limit", + "schema": { + "type": "integer", + "default": 100, + "minimum": 1 + }, + "required": false, + "description": "Size limit for returned array" + }, "offset": { "in": "query", "name": "offset", @@ -17824,6 +18925,18 @@ "example": "contact_id" } }, + "overwrites": { + "name": "overwrites", + "in": "query", + "description": "Send it as 'true' to receive attribute overwrites. Default is false.", + "schema": { + "type": "string", + "enum": [ + true, + false + ] + } + }, "uid": { "name": "uid", "in": "path", @@ -17842,15 +18955,6 @@ "type": "string" } }, - "key": { - "name": "key", - "in": "path", - "description": "Attribute key UID", - "required": true, - "schema": { - "type": "string" - } - }, "credUid": { "name": "credUid", "in": "path", @@ -17896,8 +19000,17 @@ "type": "string" } }, + "moduleIdentifier": { + "name": "moduleIdentifier", + "in": "path", + "description": "Module identifier (can be uid or key)", + "required": true, + "schema": { + "type": "string" + } + }, "contactId": { - "name": "contact_id", + "name": "contactId", "in": "path", "description": "The external ID, contact_id, of the educator contact", "required": true, @@ -17985,9 +19098,6 @@ } }, "security": [ - { - "AWS": [] - }, { "JWT": [] }