Hey,
thanks for your last example. I found my mistake.
A copy from my first post, second example:
parameters:
sessionInformation:
- name: sessionInformation
in: body
required: true
schema:
$ref: '#/definitions/Session'
I placed a '-' before the name, that causes the trouble and generated the
mysterious (for me) error: 'is not exactly one from
<#/definitions/bodyParameter>,<#/definitions/nonBodyParameter>'. If I
delete the minus, everything is fine.
Thanks, Philipp
Am Dienstag, 13. Juni 2017 23:33:34 UTC+2 schrieb Ron:
>
> Hi Philipp,
>
> The example you gave is indeed buggy, but I don’t know if it’s because the
> original was buggy, or as you said, being on the road kinda jumped things
> around.
>
> Based on your example, I’m attaching a definition that’s valid – let me
> know if that helps or if you have any further questions.
>
> parameters:
> session:
> name: session
> in: body
> schema:
> $ref: '#/definitions/sessionData'
>
> definitions:
> sessionData:
> type: object
> properties:
> sessionId:
> type: string
> timestamp:
> type: string
>
> paths:
> /services/{serviceId}/start:
> parameters:
> - name: serviceId
> in: path
> required: true
> type: integer
> post:
> parameters:
> - $ref: '#/parameters/session'
> responses:
> '200':
> description: sample
>
>
>
> On 13/06/2017, 12:13, "'Philipp' via Swagger" <
> [email protected] <javascript:>> wrote:
>
> So again, I know it. But I also described an alternative (use an
> object which takes the set of parameter values) that produces a mysterios
> error in the editor. But still I do not know, if this error is a bug in the
> editor, or I wrote it in a wrong way, or it is not possible.
> I can write something like this:
>
> path:
> /services/{serviceId}/start:
> parameters:
> - name: serviceId
> in: path
> required: true
> type: integer
> post:
> parameters:
> - name: session
> in: body
> schema:
> ref: '#/definitions/sessionData'
>
> definitions:
> sessionData:
> type: object
> properties:
> sessionId:
> type: string
> timestamp:
> type: string
> ...
>
> So sessionData contains all my values of my standard parameters as
> attributes. That works.
> But when I try to write it like this to make the session parameter
> reusable:
>
> parameters:
> session
> name: session
> in: body
> schema:
> ref: '#/definitions/sessionData'
>
> path:
> /services/{serviceId}/start:
> parameters:
> - name: serviceId
> in: path
> required: true
> type: integer
> post:
> parameters:
> - ref: '#/parameters/session'
>
> definitions:
> sessionData:
> type: object
> properties:
> sessionId:
> type: string
> timestamp:
> type: string
> ...
>
> I get the error: is not exactly one from
> <#/definitions/bodyParameter>,<#/definitions/nonBodyParameter>
>
> I do not know what to do with it? Do I have a syntax error, is it not
> possible, is it a bug in the editor, ...?
>
> I hope my examples is not to buggy because I am on the way and have no
> access to my original file. Thanks a lot,
>
> Philipp
>
> Am Dienstag, 13. Juni 2017 18:38:02 UTC+2 schrieb Ron:
> > So again, you can’t define groups of parameters.
> > You can define individual parameters, and reference them one by one
> from the different paths.
> >
> > Take a look at
> https://github.com/OAI/OpenAPI-Specification/blob/master/guidelines/REUSE.md
> for more details.
> >
> >
> >
> >
> > From: 'Philipp' via Swagger <[email protected]>
> > Reply-To: "[email protected]" <
> [email protected]>
> > Date: Tuesday, 13 June 2017 at 1:10
> > To: Swagger <[email protected]>
> > Subject: Re: How to define a set of standard parameters for each
> path item
> >
> >
> >
> > I have a set of data, that should be send as parameter in every
> single path and I only want to describe them only once. It does not matter
> if it is designed as a group of parameters that can be referenced by every
> path, or the data is included in one object and I describe one referencable
> parameter which contains the object, or...
> > It should be something like this (textual style):
> >
> >
> > // see first example in my first post, here I have the problem that
> myStandardParameter can not be refrerenced, only parameter1 and parameter2
> can be referenced
> > parameters:
> > myStandardParameter:
> > name: parameter1
> > type: string
> > name: parameter2
> > type: ptring
> >
> > // alternative parameters
> > // see secon example in my first post. I was not able to define a
> reusable parameter that contains an objectItem/schema, I always get a
> mysterious error (see comment in the mentioned example)
> > parameters:
> > myStandardParameter:
> > name: myStandardParameter
> > object:
> > attribute1: string
> > attribute2: string
> >
> > /path:
> > ...
> > parameters:
> > ref myStandardParameters
> > name AdditionalParameter1
> > type: string
> > name: AdditionalParameter2
> > type: string
> > ...
> >
> > I hope, it is more clear now. Thanks.
> >
> > Am Dienstag, 13. Juni 2017 02:44:20 UTC+2 schrieb Ron:
> > Maybe I misunderstood – are you asking what’s the right way to
> define a reusable (single) parameter, or whether there’s a way to group a
> number of parameters and reference them as a whole group once in different
> paths?
> > --
> > You received this message because you are subscribed to the Google
> Groups "Swagger" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send an email to [email protected]
> <javascript:>.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.