JSON Naming 규칙

Yuri JI·2022년 12월 21일
0

TIL

목록 보기
1/10

프로젝트에서 Swagger 문서를 확인하는 도중 팀원과 내가 서로 다른 네이밍 문법으로 변수명을 작성하고있는 것을 보고 멘토님께 질문을 드렸다 🙇

📌 참고하라고 보내주신 링크
https://jsonapi.org/recommendations/#naming

해당 링크에는 다음과 같이 써있다.

Naming

The specification places certain hard restrictions on how members (i.e., keys) in a JSON.
To further standardize member names, which is especially important when mixing profiles authored by different parties, the following rules are also recommended:

Member names SHOULD be camel-cased (i.e., wordWordWord)
Member names SHOULD start and end with a character “a-z” (U+0061 to U+007A)
Member names SHOULD contain only ASCII alphanumeric characters (i.e., “a-z”, “A-Z”, and “0-9”)


이 사양은 JSON에서 구성원(i.e., 키)이 어떻게 되는지에 대해 특정 엄격한 제한을 둡니다.
다른 당사자가 작성한 프로필을 혼합할 때 특히 중요한 구성원 이름을 추가로 표준화하려면 다음 규칙도 권장됩니다:

key는 camel-cased를 사용해야 합니다. (i.e., wordWordWord)
key는 "a-z" 문자로 시작하고 끝나야 합니다.
key는 ASCII 영숫자만 포함해야 합니다. (예: "a-z", "A-Z" 및 "0-9")

결론

💡 Member (변수명이라고 이해함) 이름은 camel-cased를 이용하자. (i.e wordWordWord)

💡 아스키 형식의 알파벳과 숫자만 사용 하자 !

profile
안녕하세요 😄

0개의 댓글