<commit_before># vim: set filetype=yaml:
---
swagger: '2.0'

info:
  version: '0.1'
  title: {{ Name }}
  description: Rekt Internal API

host: {{ Endpoint }}
basePath: /{{ Stage }}

schemes:
  - http
  - https

consumes:
  - application/json

produces:
  - application/json

paths:
  /reviews:
    x-swagger-router-controller: controller
    post:
      description: Creates a new review
      operationId: createReview
      parameters:
        - name: body
          description: Request Payload
          in: body
          required: true
          schema:
            $ref: '#/definitions/CreateReviewRequest'
      responses:
        201:
          description: Review Created
          schema:
            $ref: '#/definitions/Review'
      x-amazon-apigateway-integration:
        type: aws
        httpMethod: POST
        credentials: {{ ServicerArn }}
        uri: {{ CreateReviewLambdaUri }}
        passthroughBehavior: when_no_templates
        responses:
          default:
            statusCode: 201
definitions:
  CreateReviewRequest:
    title: Create Review Request
    required:
      - title
      - url
      - submitter
    properties:
      title:
        type: string
        description: Review title
      description:
        type: string
        description: Review description
      url:
        type: string
        description: Review source url
      submitter:
        type: string
        description: Review author

  Review:
    required:
      - id
      - timestamp
      - title
      - description
      - url
      - submitter
    properties:
      id:
        type: string
        description: UUID
      timestamp:
        type: integer
        format: int64
        description: Create date as unix epoch in milliseconds
      title:
        type: string
        description: Review title
      description:
        type: string
        description: Review description
      url:
        type: string
        description: Review source url
      submitter:
        type: string
        description: Review author
<commit_msg>Add CORS to API Gateway integration<commit_after># vim: set filetype=yaml:
---
swagger: '2.0'

info:
  version: '0.1'
  title: {{ Name }}
  description: Rekt Internal API

host: {{ Endpoint }}
basePath: /{{ Stage }}

schemes:
  - http
  - https

consumes:
  - application/json

produces:
  - application/json

paths:
  /reviews:
    x-swagger-router-controller: controller

    post:
      description: Creates a new review
      operationId: createReview
      parameters:
        - name: body
          description: Request Payload
          in: body
          required: true
          schema:
            $ref: '#/definitions/CreateReviewRequest'
      responses:
        201:
          description: Review Created
          schema:
            $ref: '#/definitions/Review'
          headers:
            Access-Control-Allow-Headers: { type: string }
            Access-Control-Allow-Methods: { type: string }
            Access-Control-Allow-Origin:  { type: string }
      x-amazon-apigateway-integration:
        type: aws
        httpMethod: POST
        credentials: {{ ServicerArn }}
        uri: {{ CreateReviewLambdaUri }}
        passthroughBehavior: when_no_templates
        responses:
          default:
            statusCode: 201
            responseParameters:
              method.response.header.Access-Control-Allow-Headers: "'Content-Type'"
              method.response.header.Access-Control-Allow-Methods: "'POST,OPTIONS'"
              method.response.header.Access-Control-Allow-Origin: "'*'"

    options:
      description: CORS Support
      responses:
        200:
          description: CORS Configuration
          headers:
            Access-Control-Allow-Headers: { type: string }
            Access-Control-Allow-Methods: { type: string }
            Access-Control-Allow-Origin:  { type: string }
      x-amazon-apigateway-integration:
        type: mock
        requestTemplates:
          application/json: '{ "statusCode": 200 }'
        responses:
          default:
            statusCode: 200
            responseParameters:
              method.response.header.Access-Control-Allow-Headers: "'Content-Type'"
              method.response.header.Access-Control-Allow-Methods: "'POST,OPTIONS'"
              method.response.header.Access-Control-Allow-Origin: "'*'"

definitions:
  CreateReviewRequest:
    title: Create Review Request
    required:
      - title
      - url
      - submitter
    properties:
      title:
        type: string
        description: Review title
      description:
        type: string
        description: Review description
      url:
        type: string
        description: Review source url
      submitter:
        type: string
        description: Review author

  Review:
    required:
      - id
      - timestamp
      - title
      - description
      - url
      - submitter
    properties:
      id:
        type: string
        description: UUID
      timestamp:
        type: integer
        format: int64
        description: Create date as unix epoch in milliseconds
      title:
        type: string
        description: Review title
      description:
        type: string
        description: Review description
      url:
        type: string
        description: Review source url
      submitter:
        type: string
        description: Review author


{'fraction_non_alphanumeric': 0.08058270330075604, 'fraction_numerical': 0.006085192697768763, 'mean_word_length': 1.7815384615384615, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4780558', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1400, 'n_words': 381}