LoginSignup
4
3

More than 1 year has passed since last update.

仕様書に出てくるMUST、SHOULD、MAY、REQUIRED、SHALL...どう解釈すればいいのか

Last updated at Posted at 2022-07-22

MUST、SHOULD、MAY、REQUIRED、SHALL...
RFCなどの仕様書を読んでいるとよく見かけるこれらの単語、結局どのように解釈すればいいんだっけと?となったので改めて調べてた。
(n^n番煎じなので備忘録として記事にします)

これらの用語(ラベルと呼ばれる)は RFC2119 で定義されている。

結論

ラベル レベル感
MUSTREQUIREDSHALL 絶対に守るべき項目。
SHOULDRECOMMENDED 特別な理由がない限りは守るべき項目。
MAYOPTIONAL 完全に任意。
SHOULD NOTNOT RECOMMENDED 特別な理由がない限りは禁止されている項目。
MUST NOTSHALL NOT 絶対的に禁止されている項目。

RFC2119

MUSTREQUIREDSHALL

MUST This word, or the terms "REQUIRED" or "SHALL", mean that the
definition is an absolute requirement of the specification.


MUST この単語、または「REQUIRED」または「SHALL」という用語は、その定義が本仕様の絶対的な要件であることを意味します。

つまり仕様に準拠するのであれば、MUST、REQUIRED、SHALLのラベルが付けられた項目は絶対に守らなければいけない。

MUST NOTSHALL NOT

MUST NOT This phrase, or the phrase "SHALL NOT", mean that the
definition is an absolute prohibition of the specification.


このフレーズ、または「SHALL NOT」というフレーズは、その定義が本仕様で絶対的に禁止されていることを意味します。

言葉通り、MUST NOTまたはSHALL NOTのラベルが付けられた項目は絶対的に禁止されている。

SHOULDRECOMMENDED

SHOULD This word, or the adjective "RECOMMENDED", mean that there
may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course.


この単語、または形容詞「RECOMMENDED」は、特定の状況で特定の項目を無視する正当な理由が存在する可能性があることを意味しますが、別の方法を選択する前に、無視することの意味を完全に理解し、慎重に検討する必要があります。

これは、特別な事情がない限りは基本的に守るべきものと理解してもよさそう。
特定の状況においては無視しても良いが、それによって起こりうる事象を完全に理解していることが前提。

SHOULD NOTNOT RECOMMENDED

SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that
there may exist valid reasons in particular circumstances when the
particular behavior is acceptable or even useful, but the full
implications should be understood and the case carefully weighed
before implementing any behavior described with this label.


このフレーズ、または「NOT RECOMMENDED」というフレーズは、特定の動作が許容できる、もしくは有用となるような特定の状況で正当な理由が存在する可能性があることを意味しますが、このラベルで説明されている動作を実装する前に、実装することの意味を完全に理解し、状況を慎重に検討する必要があります。

これは基本的には実装してはいけないと考えてもよさそう。
実装が必要となるような正当な理由がある場合は、それによる影響をよくよく考慮して、本当に必要なものかを検討しなければならない。

MAYOPTIONAL

MAY This word, or the adjective "OPTIONAL", mean that an item is
truly optional. One vendor may choose to include the item because a
particular marketplace requires it or because the vendor feels that
it enhances the product while another vendor may omit the same item.
An implementation which does not include a particular option MUST be
prepared to interoperate with another implementation which does
include the option, though perhaps with reduced functionality. In the
same vein an implementation which does include a particular option
MUST be prepared to interoperate with another implementation which
does not include the option (except, of course, for the feature the
option provides.)


この単語、または形容詞「OPTIONAL」は、項目が真に任意であることを意味します。あるベンダーは、別のベンダーが本項目を無視したとしても、特定の市場で本項目が必要とされている、もしくは本項目がベンダーの製品を強化すると感じているために本項目を含めることを選択できます。特定のオプションを含まない実装は、おそらく機能が低下しているものの、オプションを含む別の実装と相互運用できるように準備する必要があります。同様に、特定のオプションを含む実装は、オプションを含まない別の実装と相互運用できるように準備する必要があります(もちろん、オプションが提供する機能を除く)。

長々と書かれているが、このラベルがあるものは完全に任意であると理解できる。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3