property substitution referencing another environment variable - liquibase

As listed in the docs https://docs.liquibase.com/concepts/changelogs/property-substitution.html we can use property substitution like below
databaseChangeLog:
- property:
name: table.name
value: tableA
- changeSet:
My question is if its possible to have a property reference an environment variable, something like below which I tried but unfortunately did not work
databaseChangeLog:
- property:
name: table.name
value: ${SOME_ENV_VARIABLE}
- changeSet:

Related

Petapoco - Value cannot be null. Parameter name: key

While trying to use
_database.Delete(pocoObjects);
I get the error:
Value cannot be null. Parameter name: key
I should have been able to tell by the name, but I didn't realize the petapoco object I was trying to delete was a list.
Instead of:
_database.Delete(pocoObjects);
I should be using:
pocoObjects.ForEach(entity => database.Delete(entity));

How to define a field in an object is unique in openapi?

I have this api documentation written in OpenAPI 3.0.3
openapi: 3.0.3
info:
version: '1.0'
title: 'MyTitle'
description: Specification for Bear Store
servers:
- url: https://development.example.com/v1
description: Development Server
paths:
'/v1/bears':
get:
description: Requests a lists all the bears
summary: List of bears request
responses:
'200':
description: List of Bears
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
I have a Bear object that has id, and name properties. I want to define that id field is a unique field. How can I define this in OpenAPI 3?
OpenAPI lets you define a field's type and its expected format. But it's not possible for it to ensure its uniqueness.
Uniqueness is a business concern, which might involve non-trivial checks. Therefore, it's outside the scope of OpenAPI/Swagger to formalize such concepts.
However, you can add a description to explain the requirement that the field value must be unique, then implement necessary checks in the API to ensure that the value supplied by the client is actually unique.

Is it possible to specify a parameter as required for one endpoint and optional as another in Openapi 3.0?

I’m using Openapi 3.0 and I am trying to create a query parameter that is required for one endpoint and optional for another. Since parameters are now defined using schemas, I don’t know if this is possible.
Yes it's possible - both in OpenAPI 3.0 and 2.0. In the context of parameters, the required attribute is a parameter-level attribute, not a schema attribute.
paths:
/something:
get:
parameters:
- in: query
name: foo
required: true # <-----
schema:
type: string
...
/something-else:
get:
parameters:
- in: query
name: foo
required: false # <----- Can be omitted because parameters are optional by default
schema:
type: string
...

How to reuse swagger definitions and remove some of the parameters in it? [duplicate]

This question already has answers here:
Re-using model with different required properties
(2 answers)
Closed 3 years ago.
This is my code:
definitions:
User:
type: object
properties:
id:
type: integer
username:
type: string
first_name:
type: string
last_name:
type: string
password:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
required:
- username
- first_name
- last_name
- password
/api/users:
post:
description: Add a new user
operationId: store
parameters:
- name: user
description: User object
in: body
required: true
type: string
schema:
$ref: '#/definitions/User'
produces:
- application/json
responses:
"200":
description: Success
properties:
success:
type: boolean
data:
$ref: '#/definitions/User'
As you can see, in the post key under /api/users I used the User definition as my schema on it.
I want to lessen my code so I reused the User definition as my schema. The problem here is that I do not need the id, created_at and updated_at fields.
Is there a way to just inherit some of the fields except the fields mentioned? Also, I would love some suggestions to make it better since I'm trying to learn swagger. Thank you.
As explained in this answer to a similar question:
You would have to define the models separately.
However, you have options for the cases of exclusion and difference.
If you're looking to exclude, which is the easy case, create a model
of with the excluded property, say ModelA. Then define ModelB as
ModelA plus the additional property:
ModelB:
allOf:
- $ref: "#/definitions/ModelA"
- type: object
properties:
id:
type: string
If you're looking to define the difference, follow the same method
above, and exclude the id from ModelA. Then define ModelB and ModelC
as extending ModelA and add the id property to them, each with its own
restrictions. Mind you, JSON Schema can allow you to follow the
original example above for some cases to "override" a definition.
However, since it is not really overriding, and one needs to
understand the concepts of JSON Schema better to not make simple
mistakes, I'd recommend going this path for now.

Rules for creating preference objects

What are the rules to creating preference objects using the WSAPI?
Do you need to specify a workspace, project, or user or some combination?
When do preference names conflict with other names? Can you have the same Name field value but for a different user?
I am seeing the following error when I try to create a second preference object: Validation error: Preference.Value conflicts with NAME (where NAME is the value in the name field). What triggers this?
Thanks...
Yes, you need to specify one (and only one) of Workspace, Project, or User. This is the "scope" of the preference.
You can specify the same name for different scope values. For example, all of these are valid:
Name: 'A', User: 'Bob', Value: 'some value'
Name: 'B', User: 'Bob', Value: 'some value'
Name: 'A', User: 'Larry', Value: 'some value'
Name: 'A', Workspace: 'WS1', Value: 'some value'
But trying to create a new Preference with Name 'A' and User 'Bob' would fail, since that Name/Scope combination already exists.