-2

I can't find the error from what it's telling me:

243
should match exactly one schema in oneOf
244
should be equal to one of the allowed values allowedValues: query, header,     cookie

The 244 error is kinda really strange since he's saying if I'm replacing path with query I should use one of the valid statements where then instead of query path is written in the error code.

This errors just appear if i have the IstGeloescht param in it. When I remove the whole block, it's fine, but as far as i know it should be correct. Since I've seen some errors are hidden and only appear when we fix something else, I decided to show you all of the code.

openapi: 3.0.0
servers: []
info:
  description:  REST API
  version: "1.0.0"
  title:  REST API
  contact:
    email: info@lala.net
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
  - name: Adresse
    description: Adressendpunkt der REST API

paths:

/v2/ADR/Adresse:

get:
  tags:
    - Adresse
  summary: Gibt alle Adressen zurück.
  operationId: V2ADRAdresseGet
  description: |
    Gibt alle Adressen der zurück.
  parameters:
    - $ref: '#/components/parameters/Sort'
    - $ref: '#/components/parameters/Limit'
    - $ref: '#/components/parameters/Offset'
    - $ref: '#/components/parameters/Filter'
    - $ref: '#/components/parameters/Depth'
    - $ref: '#/components/parameters/Fields'
    - $ref: '#/components/parameters/IstGeloescht'

  responses:
    '200':
      description: search results matching criteria
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/adresseModell'
    '400':
      description: bad input parameter

components:

schemas:

adresseModell: 
  required: 
    - Name
    - PLZ
    - Ort
  type: object
  properties: 
    AdressNr: 
      format: int32
      type: integer
    Name: 
      description: "Beinhaltet Firmenname bei Firmenadressen"
      maxLength: 40
      type: string
    Vorname: 
      description: Optional
      maxLength: 40
      type: string
    Strasse: 
      description: Optional
      maxLength: 40
      type: string
    PLZ: 
      maxLength: 10
      type: string
    Ort: 
      maxLength: 40
      type: string
    Geloescht: 
      description: "Kann nicht gefiltert werden, URL-Parameter verwenden"
      type: boolean
    Adressgruppen: 
      description: "dieses Feld kann nicht gefiltert oder sortiert werden"
      uniqueItems: false
      type: string
    Anrede: 
      description: Optional
      maxLength: 40
      type: string
    Bemerkungen: 
      description: Optional
      maxLength: 100000
      type: string
    EMail: 
      description: Optional
      maxLength: 100
      type: string
    TelDirekt: 
      description: Optional
      maxLength: 40
      type: string
    TelZentrale: 
      description: Optional
      maxLength: 40
      type: string
    TelPrivat: 
      description: Optional
      maxLength: 40
      type: string
    Fax: 
      description: Optional
      maxLength: 40
      type: string
    Mobiltelefon: 
      description: Optional
      maxLength: 40
      type: string
    Homepage: 
      description: Optional
      maxLength: 100
      type: string
    PLZPostfach: 
      description: Optional
      maxLength: 50
      type: string
    Postfach: 
      description: Optional
      maxLength: 50
      type: string
    Region: 
      description: Optional
      type: string
    Land: 
      type: string
      description: Optional
    Longitude: 
      format: double
      description: Optional
      type: number
    Latitude: 
      format: double
      description: Optional
      type: number
    DebitorenSteuercode: 
      type: string
      description: Optional
    DebitorenSteuercodeVerwenden: 
      description: "Bei True wird der Steuercode der Adresse verwendet und übersteuert andere Steuercodes, optional"
      type: boolean
    DebitorenErtragskonto: 
      type: string
      description: Optional
    DebitorenErtragskontoVerwenden: 
      description: "Bei True wird der Steuercode der Adresse verwendet und übersteuert andere Steuercodes, optional"
      type: boolean
    DebitorenWaehrung: 
      type: string
      description: Optional
    DebitorenKostenstelle: 
      type: string
      description: Optional
    DebitorenKostenstelleVerwenden: 
      description: "Bei True wird der Steuercode der Adresse verwendet und übersteuert andere Steuercodes, optional"
      type: boolean
    DebitorenKostenart: 
      type: string
      description: Optional
    DebitorenKostenartVerwenden: 
      description: "Bei True wird der Steuercode der Adresse verwendet und übersteuert andere Steuercodes, optional"
      type: boolean
    DebitorenRabatt: 
      format: double
      description: Optional
      type: number
    Vertreter: 
      type: string
      description: Optional
    Lagerpreis: 
      format: int32
      description: Optional
      type: integer
    Geburtsdatum: 
      description: Optional
      type: string
    ErstelltAm: 
      type: string
    ErstelltVon: 
      type: string
    GeaendertAm: 
      type: string
    GeaendertVon: 
      type: string
    Zusatzfelder: 
      type: object
    additionalProperties: 
      type: object

parameters:

Sort:
  in: query
  name: sort
  schema:
    type: integer
  description: Kommagetrennte Liste der Felder die aufsteigend sortiert werden sollen (ein Minus vor der Feldbezeichnung sortiert absteigend), eingebette Objekte können nur nach dem Primärschlüssel sortiert werden

Limit:
  in: query
  name: limit
  schema:
    type: integer
  description: Limitiert die Anzahl Datensätze die zurückgegeben wird

Offset:
  in: query
  name: offset
  schema:
    type: integer
  description: Legt fest bei welchem Datensatz gestartet werden soll

Filter:
  in: query
  name: filter
  schema:
    type: integer
  description: Ermöglicht innerhalb eines Felds nach Werten zu filtern (Details im Kapitel Filter Syntax)

Depth:
  in: query
  name: depth
  schema:
    type: integer
  description: Gibt an, wie viele Hierarchie-Stufen an Unterobjekten komplett eingebettet werden sollen (Details im Kapitel Einbettungstiefe)

Fields:
  in: query
  name: fields
  schema: 
    type: integer
  description: Kommagetrennte Liste der Felder welche zurückgegeben werden sollen (der Primärschlüssel wird in jedemfall zurückgegeben)

IstGeloescht:
  in: path
  name: istgeloescht
  schema:
    type: string
    enum:
      - yes
      - no
      - any
  description: Kommagetrennte Liste der Felder welche zurückgegeben werden sollen (der Primärschlüssel wird in jedemfall zurückgegeben)  
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Syzard
  • 1
  • 1
  • To recap the linked Q&A - your path parameter `IstGeloescht` is missing `required: true`. – Helen Sep 12 '18 at 11:42
  • it's not required but now i changed path to query and the error disaperas (after my lunch) may a editor error from swagger hub? Ah it's Written here i have overreaded it. https://swagger.io/docs/specification/describing-parameters/ on Required and Optional parameters – Syzard Sep 12 '18 at 11:44

1 Answers1

0

Is IstGeloescht supposed to be a path parameter (/v2/ADR/Adresse/{IstGeloescht}) or a query parameter (/v2/ADR/Adresse?IstGeloescht=...)? It's currently defined as a path parameter - if so, you need to update the path and add required: true to the path parameter. If it's a query parameter, change in: path to in: query instead.

Also, some YAML parsers handle yes and no as the boolean values true and false. I'd suggest enclosing these values in quotes to make sure they are parsed as strings.

        enum:
          - 'yes'   # <------
          - 'no'    # <------
          - any
Helen
  • 87,344
  • 17
  • 243
  • 314