YAMLのキーの命名に関して既存ソフトウェアの形式を調べる - snake_caseかcamelCaseかkebab-caseか
GitHub Action
kebab-caseとsnake_caseの混在。
以下は例。
code:yaml
on:
pull_request:
# Sequence of patterns matched against refs/heads
branches-ignore:
- 'mona/octocat'
- 'releases/**-alpha'
kebab-caseの他の例としてruns-onがある。
推測では、本当はkebab-caseで進めたかったのだろうけど、on: ["pull_request"]のようにタイプのようなものはsnake_caseにしていて、その"pull_request"にオプションを後からつけた結果上のように混在してしまったのではないかと思う。
これも推測だが、以下のpermissionsはタイプのようなものを表すが、kebab-caseにしていて、これは後の方針で「新規追加はkebab-caseにしよう」となったのではないかと思う。
permissions: read-all|write-all
CircleCI
kebab-caseとsnake_caseの混在。
以下は例。
code:yaml
- attach_workspace:
at: /tmp/workspace
code:yaml
pre-steps: # steps to run before steps defined in the job bar
- run:
command: echo "install custom dependency"
post-steps: # steps to run after steps defined in the job bar
Swagger
小文字始まりのcamelCase。
code:yaml
version: 1.0.0
# API description. Arbitrary text in CommonMark or HTML.
description: This is a sample server for a pet store.
# Link to the page that describes the terms of service.
# Must be in the URL format.
Envoy
小文字始まりのsnake_case。
code:yaml
admin:
address:
socket_address: { address: 127.0.0.1, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 127.0.0.1, port_value: 10000 }
...
Jekyll
小文字始まりのsnake_case。
code:yaml
# Where things are
source : .
destination : ./_site
collections_dir : .
plugins_dir : _plugins # takes an array of strings and loads plugins in that order
layouts_dir : _layouts
data_dir : _data
includes_dir : _includes
Docker Compose
小文字始まりのsnake_case。
code:yaml
depends_on:
- db
Kubernetes
小文字始まりのcamelCase。
code:yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: game-demo
AWS SAMテンプレート
大文字始まりのcamelCase。
以下のAvailabilityZoneなど。
code:yaml
Resources:
MyInstance:
Type: "AWS::EC2::Instance"
Properties:
UserData:
"Fn::Base64":
!Sub |
Queue=${MyQueue}
AvailabilityZone: "us-east-1a"
ImageId: "ami-0ff8a91507f77f867"
MyQueue:
Type: "AWS::SQS::Queue"
Properties: {}
Prometheus
小文字始まりのsnake_case。
code:yaml
# my global config
global:
scrape_interval: 15s
evaluation_interval: 30s
# scrape_timeout is set to the global default (10s).
external_labels:
monitor: codelab
foo: bar
rule_files:
- "first.rules"
- "my/*.rules"
...
Datadog
小文字始まりのsnake_case。
code:yaml
api_key:
...
JSON Web Key (JWK)
JSONではあるが。
小文字始まりのsnake_case。(key_ops)
code:json
{
"alg": "ES384",
"crv": "P-384",
"ext": true,
"key_ops": [
"verify"
],
"kty": "EC",
...
}
おまけ:公式
自由。
code:yaml
%YAML 1.2
---
YAML: YAML Ain't Markup Language™
What It Is:
YAML is a human-friendly data serialization
language for all programming languages.
YAML Resources:
YAML Specifications:
- YAML 1.2:
- Revision 1.2.2 # Oct 1, 2021 *New*
- Revision 1.2.1 # Oct 1, 2009
- Revision 1.2.0 # Jul 21, 2009
- YAML 1.1
- YAML 1.0
...