{
  "openapi": "3.1.1",
  "info": {
    "title": "Dadda.se PwGen API",
    "description": "Generates passwords using cryptographically secure server-side randomness. Results are neither stored nor logged by the API.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://www.dadda.se/"
    }
  ],
  "paths": {
    "/api/pwgen/characters": {
      "post": {
        "tags": [
          "PwGen"
        ],
        "summary": "Genererar ett teckenbaserat lösenord",
        "operationId": "GenerateCharacterPassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CharacterPasswordRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/pwgen/words": {
      "post": {
        "tags": [
          "PwGen"
        ],
        "summary": "Genererar ett lösenord av slumpade ord",
        "operationId": "GenerateWordPassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WordPasswordRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/pwgen/sentence": {
      "post": {
        "tags": [
          "PwGen"
        ],
        "summary": "Genererar adjektiv, substantiv, verb och adverb",
        "operationId": "GenerateSentencePassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SentencePasswordRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CharacterPasswordRequest": {
        "type": "object",
        "properties": {
          "length": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32",
            "default": 20
          },
          "lowercase": {
            "type": "boolean",
            "default": true
          },
          "uppercase": {
            "type": "boolean",
            "default": true
          },
          "numbers": {
            "type": "boolean",
            "default": true
          },
          "specialCharacters": {
            "type": "boolean",
            "default": true
          },
          "swedishCharacters": {
            "type": "boolean",
            "default": false
          },
          "specialCharacterPercentage": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32",
            "default": 0
          }
        }
      },
      "HttpValidationProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "PasswordResponse": {
        "required": [
          "password",
          "length",
          "type"
        ],
        "type": "object",
        "properties": {
          "password": {
            "type": "string"
          },
          "length": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "type": {
            "type": "string"
          }
        }
      },
      "SentencePasswordRequest": {
        "type": "object",
        "properties": {
          "language": {
            "type": "string",
            "default": "sv"
          },
          "casing": {
            "type": "string",
            "default": "title"
          },
          "numberPosition": {
            "type": "string",
            "default": "before"
          },
          "numberLength": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32",
            "default": 2
          },
          "replaceSwedishCharacters": {
            "type": "boolean",
            "default": false
          },
          "replaceWithSpecialCharacters": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "WordPasswordRequest": {
        "type": "object",
        "properties": {
          "language": {
            "type": "string",
            "default": "sv"
          },
          "wordCount": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32",
            "default": 4
          },
          "casing": {
            "type": "string",
            "default": "title"
          },
          "numberPosition": {
            "type": "string",
            "default": "before"
          },
          "numberLength": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32",
            "default": 2
          },
          "replaceSwedishCharacters": {
            "type": "boolean",
            "default": false
          },
          "replaceWithSpecialCharacters": {
            "type": "boolean",
            "default": false
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "PwGen"
    }
  ]
}