4ce861c8ad
This patch adds support for XML validation with RelaxNG. The original S3 schema is available at http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.xsd, but I write a schema for swift3 from scratch. It is because: - The original schema does not support all of the latest S3 API. Even if we use it, we have to update and maintain it in either way. - The original schema is written with XML Schema, but the language is not enough to describe some of the latest S3 API. For example, the Multi-Object Delete operation sends an XML document, which can interleave a Quiet element with Object elements. XML Schema cannot define such kinds of XML documents. This patch includes both RelaxNG (rng) and RelaxNG compact syntax files (rnc) for validation. What I wrote are only rnc files, and rng files are automatically generated from rnc with trang, the most well-known schema converter. If possible, I'd like to use only rnc schemas since rng files are complicated and not so human-readable. However, lxml doesn't support RelaxNG compact syntax currently, unfortunately. After lxml supports compact syntax, let's remove all of the rng files. This patch also fixes some XML errors detected by RelaxNG validator, and some helper methods to convert strings between camel-case name and snake-case name. Change-Id: I4513345a6b981efc5d5f5e8cf528aba84ac1bdad
21 lines
446 B
Plaintext
21 lines
446 B
Plaintext
include "common.rnc"
|
|
|
|
start =
|
|
element LifecycleConfiguration {
|
|
element Rule {
|
|
element ID { xsd:string }? &
|
|
element Prefix { xsd:string } &
|
|
element Status { "Enabled" | "Disabled" } &
|
|
element Transition { Transition }? &
|
|
element Expiration { Expiration }?
|
|
}+
|
|
}
|
|
|
|
Expiration =
|
|
element Days { xsd:int } |
|
|
element Date { xsd:dateTime }
|
|
|
|
Transition =
|
|
Expiration &
|
|
element StorageClass { StorageClass }
|