Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add complete promise api #63

Merged
merged 1 commit into from
Sep 19, 2023
Merged

Add complete promise api #63

merged 1 commit into from
Sep 19, 2023

Conversation

dfarr
Copy link
Member

@dfarr dfarr commented Sep 19, 2023

openapi: 3.0.3
info:
    title: Promise API
    version: 1.0.0
servers:
    - url: http://localhost:8001
paths:
    /promises/{id}/complete:
        post:
            tags:
                - promises
            summary: Complete a promise
            operationId: completePromise
            parameters:
                - name: id
                    in: path
                    required: true
                    style: simple
                    explode: false
                    schema:
                        type: string
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: "#/components/schemas/CompletePromiseRequest"
                required: true
            responses:
                "200":
                    description: Operation deduplicated, Promise fetched successfully
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/Promise"
                "201":
                    description: Promise completed successfully
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/Promise"
                "400":
                    description: Invalid input
                "403":
                    description: Forbidden, Promise in incorrect state
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/Promise"
components:
    schemas:
        Promise:
            type: object
            properties:
                id:
                    type: string
                state:
                    type: string
                    enum:
                        - PENDING
                        - RESOLVED
                        - REJECTED
                        - REJECTED_CANCELED
                        - REJECTED_TIMEDOUT
                param:
                    $ref: "#/components/schemas/Value"
                value:
                    $ref: "#/components/schemas/Value"
                timeout:
                    type: integer
        Value:
            type: object
            properties:
                ikey:
                    type: string
                data:
                    type: string
                headers:
                    type: object
                    additionalProperties:
                        type: string
        CompletePromiseRequest:
            type: object
            properties:
                state:
                    type: string
                    enum:
                        - RESOLVED
                        - REJECTED
                        - REJECTED_CANCELED
                value:
                    $ref: "#/components/schemas/Value"

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #63 (1745719) into main (9e1276a) will decrease coverage by 0.62%.
The diff coverage is 73.46%.

@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
- Coverage   68.91%   68.29%   -0.62%     
==========================================
  Files          40       41       +1     
  Lines        3934     4227     +293     
==========================================
+ Hits         2711     2887     +176     
- Misses       1038     1143     +105     
- Partials      185      197      +12     
Files Changed Coverage Δ
pkg/promise/promise.go 58.92% <5.00%> (-35.67%) ⬇️
test/dst/model.go 50.64% <45.83%> (-0.56%) ⬇️
internal/app/coroutines/completePromise.go 76.41% <76.41%> (ø)
internal/kernel/types/api_request.go 89.06% <100.00%> (+1.34%) ⬆️
internal/kernel/types/api_response.go 71.42% <100.00%> (+2.41%) ⬆️
test/dst/dst.go 90.24% <100.00%> (+2.36%) ⬆️
test/dst/generator.go 95.30% <100.00%> (+0.65%) ⬆️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dfarr dfarr merged commit 1ad9f62 into main Sep 19, 2023
3 of 4 checks passed
@dfarr dfarr deleted the feature/complete-promise branch September 19, 2023 18:24
@dfarr dfarr mentioned this pull request Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant