ServerVariable.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php declare(strict_types=1);
  2. /**
  3. * @license Apache 2.0
  4. */
  5. namespace OpenApi\Annotations;
  6. /**
  7. * @Annotation
  8. * A Server Variable Object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#server-variable-object
  9. * An object representing a Server Variable for server URL template substitution.
  10. */
  11. class ServerVariable extends AbstractAnnotation
  12. {
  13. /**
  14. * The key into Server->variables array.
  15. *
  16. * @var string
  17. */
  18. public $serverVariable = UNDEFINED;
  19. /**
  20. * An enumeration of string values to be used if the substitution options are from a limited set.
  21. *
  22. * @var string[]
  23. */
  24. public $enum = UNDEFINED;
  25. /**
  26. * The default value to use for substitution, and to send, if an alternate value is not supplied.
  27. * Unlike the Schema Object's default, this value must be provided by the consumer.
  28. *
  29. * @var string
  30. */
  31. public $default = UNDEFINED;
  32. /**
  33. * A map between a variable name and its value.
  34. * The value is used for substitution in the server's URL template.
  35. *
  36. * @var array
  37. */
  38. public $variables = UNDEFINED;
  39. /**
  40. * An optional description for the server variable.
  41. * CommonMark syntax MAY be used for rich text representation.
  42. *
  43. * @var string
  44. */
  45. public $description = UNDEFINED;
  46. /**
  47. * @inheritdoc
  48. */
  49. public static $_parents = [
  50. Server::class
  51. ];
  52. /**
  53. * @inheritdoc
  54. */
  55. public static $_required = ['default'];
  56. /**
  57. * @inheritdoc
  58. */
  59. public static $_types = [
  60. 'default' => 'string',
  61. 'description' => 'string',
  62. ];
  63. }