Skip to content

Commit

Permalink
Merge pull request #12 from SmartBear-DevRel/feat/license-related-types
Browse files Browse the repository at this point in the history
Feat/license-related-types
  • Loading branch information
YOU54F authored Oct 19, 2023
2 parents be1a0ba + 4e46fd2 commit fa4a52e
Show file tree
Hide file tree
Showing 21 changed files with 150 additions and 63 deletions.
105 changes: 66 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,71 @@ When necessary, a Problem Detail response _MAY_ include additional detail on the

```json
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"description": "an extension object used to enrich problem details responses for SmartBear APIs",
"properties": {
"errors": {
"type": "array",
"description": "an array of error details to accompany a problem details response",
"items": [
{
"type": "object",
"description": "an error object to provide explicit details on a problem towards an API consumer",
"properties": {
"detail": {
"type": "string",
"description": "a granular description on the specific error related to a body property, query parameter, path parameters, and/or header"
},
"pointer": {
"type": "string",
"description": "a JSON Pointer to a specific request body property that is the source of error"
},
"parameter": {
"type": "string",
"description": "the name of the query or path parameter that is the source of error"
},
"header": {
"type": "string",
"description": "the name of the header that is the source of error"
}
},
"required": [
"detail"
]
}
]
}
},
"required": [
"errors"
]
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "a string containing a URI reference that identifies the problem type. When this member is not present, its value is assumed to be `about:blank`."
},
"status": {
"type": "number",
"description": "a number indicating the HTTP status code."
},
"title": {
"type": "string",
"description": "a string containing a short, human-readable summary of the problem type."
},
"detail": {
"type": "string",
"description": "a string containing a human-readable explanation specific to this occurrence of the problem."
},
"instance": {
"type": "string",
"description": "a string containing a URI reference that identifies the specific occurrence of the problem."
},
"code": {
"type": "string",
"description": "a string containing additional provider specific codes to identify the error context."
},
"errors": {
"type": "array",
"description": "an array of error details to accompany a problem details response",
"items": [
{
"type": "object",
"description": "an error object to provide explicit details on a problem towards an API consumer",
"properties": {
"detail": {
"type": "string",
"description": "a granular description on the specific error related to a body property, query parameter, path parameters, and/or header"
},
"pointer": {
"type": "string",
"description": "a JSON Pointer to a specific request body property that is the source of error"
},
"parameter": {
"type": "string",
"description": "a string containing the name of the query or path parameter that is the source of error"
},
"header": {
"type": "string",
"description": "a string containing the name of the header that is the source of error"
},
"code": {
"type": "string",
"description": "a string containing additional provider specific codes to identify the error context."
}
},
"required": [
"detail"
]
}
]
}
},
"required": [
"title"
]
}
```
2 changes: 1 addition & 1 deletion src/pages/already-exists.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client application tried to create a resource that already exists. Perhaps

**Example of an `already-exists` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/already-exists",
"title": "Already exists",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/bad-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Your client application initiated a request that is malformed. Please review you

**Examples of a `bad-request` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/bad-request",
"title": "Bad Request",
Expand All @@ -25,7 +25,7 @@ Your client application initiated a request that is malformed. Please review you
}
```

```yaml
```json
{
"type": "about:blank",
"title": "Bad Request",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/business-rule-violation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that failed business rule validation. Please review

**Example of an `business-rule-violation` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/business-rule-violation",
"title": "Business Rule Violation",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/forbidden.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Your client application tried to perform an operation on a resource that it's no

**Examples of a `forbidden` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/forbidden",
"title": "Forbidden",
Expand All @@ -25,7 +25,7 @@ Your client application tried to perform an operation on a resource that it's no
}
```

```yaml
```json
{
"type": "about:blank",
"title": "Forbidden",
Expand Down
12 changes: 11 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,17 @@ import Card from '../components/Card.astro';
href="./business-rule-violation"
title="Business Rule Violation"
body="The request is deemed invalid as it failed business rule checks 🏢"
/>
/>
<Card
href="./license-expired"
title="License Expired"
body="The client license has expired rendering the service unavailable 📝"
/>
<Card
href="./license-cancelled"
title="License Cancelled"
body="The client license has been cancelled rendering the service unavailable 📝"
/>
</ul>

<p>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/invalid-body-property-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that contained a malformed body property. Please re

**Example of an `invalid-body-property-format` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/invalid-body-property-format",
"title": "Invalid Body Property Format",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/invalid-body-property-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that contained an invalid body property value. Plea

**Example of an `invalid-body-property-value` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/invalid-body-property-value",
"title": "Invalid Body Property Value",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/invalid-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Your client application issued a request to an API that contains invalid or malf

**Example of an `invalid-parameters` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/invalid-parameters",
"title": "Invalid parameters",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/invalid-request-header-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that contained a malformed request header. Please r

**Example of an `invalid-request-header-format` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/invalid-request-header-format",
"title": "Invalid Request Header Format",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/invalid-request-parameter-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that contained a malformed query or path parameter.

**Example of an `invalid-request-parameter-format` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/invalid-request-parameter-format",
"title": "Invalid Request Parameter Format",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/invalid-request-parameter-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that contained an invalid query or path parameter v

**Example of an `invalid-request-parameter-value` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/invalid-request-parameter-value",
"title": "Invalid Request Parameter Value",
Expand Down
25 changes: 25 additions & 0 deletions src/pages/license-cancelled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: ../layouts/Problem.astro
title: License Cancelled
description: This problem occurs when the license associated with the client has been cancelled thus rendering the service unavailable.
---

The license associated with your client/organization has been cancelled. Please contact your SmartBear account manager or representative.

| Type URI | Title | Recommended HTTP Status Code | Reference |
|----------|-------|------------------------------|-----------|
|https://problems-registry.smartbear.com/license-cancelled|License Cancelled|503||

> **Note** A problem is generally **not** meant to be used for end-user input validation, but for client developer convenience.

**Example of an `license-expired` problem details:**
```json
{
"type": "https://problems-registry.smartbear.com/license-cancelled",
"title": "License Cancelled",
"detail": "The service is unavailable as the license associated with your client or organization has been cancelled. Please contact your SmartBear account manager or representative",
"status": 503
}
```

25 changes: 25 additions & 0 deletions src/pages/license-expired.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: ../layouts/Problem.astro
title: License Expired
description: This problem occurs when the license associated with the client has expired thus rendering the service unavailable.
---

The license associated with your client/organization has expired. Please contact your SmartBear account manager or representative.

| Type URI | Title | Recommended HTTP Status Code | Reference |
|----------|-------|------------------------------|-----------|
|https://problems-registry.smartbear.com/license-expired|License Expired|503||

> **Note** A problem is generally **not** meant to be used for end-user input validation, but for client developer convenience.

**Example of an `license-expired` problem details:**
```json
{
"type": "https://problems-registry.smartbear.com/license-expired",
"title": "License Expired",
"detail": "The service is unavailable as the license associated with your client or organization has expired. Please contact your SmartBear account manager or representative",
"status": 503
}
```

2 changes: 1 addition & 1 deletion src/pages/missing-body-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that omitted an expected body property. Please revi

**Example of an `missing-body-property` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/missing-body-property",
"title": "Missing body property",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/missing-request-header.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that omitted an expected request header. Please rev

**Example of an `missing-request-header` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/missing-request-header",
"title": "Missing request header",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/missing-request-parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your client issued a request that omitted an expected query or path par. Please

**Example of an `missing-request-parameter` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/missing-request-parameter",
"title": "Missing request parameter",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/not-found.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Your client application tried to access a resource that does not exist (or could
**Examples of an `not-found` problem details:**

```yaml
```json
{
"type": "https://problems-registry.smartbear.com/not-found",
"title": "Not Found",
Expand All @@ -26,7 +26,7 @@ Your client application tried to access a resource that does not exist (or could
}
```

```yaml
```json
{
"type": "about:blank",
"title": "Not Found",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/server-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Your client application did everything correct. Unfortunately our API encountere

**Examples of a `server-error` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/server-error",
"title": "Server Error",
Expand All @@ -25,7 +25,7 @@ Your client application did everything correct. Unfortunately our API encountere
}
```

```yaml
```json
{
"type": "about:blank",
"title": "Server Error",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/service-unavailable.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Your client application did everything correct. Unfortunately our API is current

**Examples of a `service-unavailable` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/service-unavailable",
"title": "Service Unavailable",
Expand All @@ -25,7 +25,7 @@ Your client application did everything correct. Unfortunately our API is current
}
```

```yaml
```json
{
"type": "about:blank",
"title": "Service Unavailable",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/unauthorized.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Your client application issued a requested to a protected resource without suppl

**Examples of an `unauthorized` problem details:**
```yaml
```json
{
"type": "https://problems-registry.smartbear.com/unauthorized",
"title": "Unauthorized",
Expand All @@ -25,7 +25,7 @@ Your client application issued a requested to a protected resource without suppl
}
```

```yaml
```json
{
"type": "about:blank",
"title": "Unauthorized",
Expand Down

0 comments on commit fa4a52e

Please sign in to comment.