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

First version #3

Merged
merged 14 commits into from
Jul 24, 2024
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: npm run ci-test

test-action:
name: GitHub Actions Test
name: RMOA linter
runs-on: ubuntu-latest

steps:
Expand All @@ -57,8 +57,5 @@ jobs:
id: test-action
uses: ./
with:
milliseconds: 2000

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
filepath: './__tests__/testapi-oas.json'
apikey: ${{ secrets.RMOA_API_KEY }}
49 changes: 0 additions & 49 deletions .github/workflows/linter.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Rate My OpenAPI GitHub Action

4 changes: 2 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation()
})

it('sets the time output', async () => {
it.skip('sets the time output', async () => {

Check warning on line 36 in __tests__/main.test.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

Disabled test
// Set the action's inputs as return values from core.getInput()
getInputMock.mockImplementation(name => {
switch (name) {
Expand Down Expand Up @@ -65,7 +65,7 @@
expect(errorMock).not.toHaveBeenCalled()
})

it('sets a failed status', async () => {
it.skip('sets a failed status', async () => {

Check warning on line 68 in __tests__/main.test.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

Disabled test
// Set the action's inputs as return values from core.getInput()
getInputMock.mockImplementation(name => {
switch (name) {
Expand Down
296 changes: 296 additions & 0 deletions __tests__/testapi-oas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
{
"openapi": "3.1.0",
"info": {
"title": "Friendbook",
"description": "Friendbook API, powered by Zuplo. [Learn More](https://www.facebook.com/Friendbookcom-1453796218267314/)",
"version": "1.0.0"

Check warning on line 6 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Info object must have "contact" object.

Check warning on line 6 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Info object must have "license" object.

Check warning on line 6 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

License object must include "url".
},
"servers": [
{

Check warning on line 9 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Server URL must not have trailing slash.
"url": "https://www.example-api.com/"
}
],
"components": {
"schemas": {
"friend-list": {
"title": "Friends",
"type": "array",
"items": {
"title": "Friend ID",
"type": "string",
"description": "The person's user ID.",
"format": "uuid"
},
"additionalProperties": false
},
"message": {
"title": "Message",
"type": "object",
"properties": {
"content": {
"type": "string"
},
"recipientID": {
"type": "string",
"format": "uuid",
"description": "The person's user ID."
}
}
}
},
"securitySchemes": {
"api-key-auth-inbound": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"description": "Must contain the word Bearer followed by the key"
}
}
},
"paths": {
"/v1/friends/{userID}": {
"post": {
"responses": {
"200": {
"description": "Add successful",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}

Check warning on line 63 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Operation is missing responses[401].

Check warning on line 63 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Operation is missing responses[401].content.

Check warning on line 63 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Operation is missing responses[500].

Check warning on line 63 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Operation is missing responses[500].content.
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/friend-list"
}
}
},
"required": true
},
"security": [
{
"api-key-auth-inbound": []
}
],
"tags": ["Friends"],
"summary": "Add Friends",
"description": "This API lets you add friends",
"parameters": [
{
"name": "userID",
"in": "path",
"required": true,
"description": "The user's ID",
"schema": {
"type": "string",
"format": "uuid"
}
}
]

Check warning on line 94 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

Operation must have "operationId".
},
"get": {
"responses": {
"200": {
"description": "Friends",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string",
"faker": "name.findName"
}
}
}
}
},
"404": {
"description": "Not Found"
},
"5XX": {
"description": "Failure",
"headers": {
"x-vercel-cache": {
"schema": {
"type": "string",
"examples": ["MISS", "HIT", "STALE"]
},
"description": "vercel serverless cache state. see https://vercel.com/docs/concepts/edge-network/caching#x-vercel-cache"
}
},
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
},
"security": [
{
"api-key-auth-inbound": []
}
],
"tags": ["Friends"],
"summary": "View Friends",
"description": "This API lets you view your friends",
"parameters": [
{
"name": "userID",
"in": "path",
"required": true,
"description": "The user's ID",
"schema": {
"type": "string",
"format": "uuid"
}
}
]
},
"delete": {
"responses": {
"200": {
"description": "Delete successful",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/friend-list"
}
}
},
"required": true
},
"security": [
{
"api-key-auth-inbound": []
}
],
"tags": ["Friends"],
"summary": "Unfriend",
"description": "This API lets you delete friends",
"parameters": [
{
"name": "userID",
"in": "path",
"required": true,
"description": "The user's ID",
"schema": {
"type": "string",
"format": "uuid"
}
}
]
}
},
"/v1/messages/{userID}": {
"get": {
"responses": {
"200": {
"description": "Messages",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string",
"faker": "hacker.phrase"
}
}
}
}
}
},
"security": [
{
"api-key-auth-inbound": []
}
],
"tags": ["Messaging"],
"summary": "Get your messages",
"description": "Get all of your messages",
"parameters": [
{
"name": "userID",
"in": "path",
"required": true,
"description": "The user's ID",
"schema": {
"type": "string",
"format": "uuid"
}
}
]
},
"post": {
"responses": {
"200": {
"description": "Message send successful",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/message"
}
}
},
"required": true
},
"security": [
{
"api-key-auth-inbound": []
}
],
"tags": ["Messaging"],
"summary": "Send a message",
"description": "Sends a message to a recipient",
"parameters": [
{
"name": "userID",
"in": "path",
"required": true,
"description": "The user's ID",
"schema": {
"type": "string",
"format": "uuid"
}
}
]
}
}
},
"tags": [
{
"name": "Friends",
"description": "These endpoints help you manage your friends on friendbook."
},
{
"name": "Messaging",
"description": "These endpoints help you manage your messages on friendbook."
}
]

Check warning on line 295 in __tests__/testapi-oas.json

View workflow job for this annotation

GitHub Actions / RMOA linter

'security' must be defined and not empty
}
Loading