Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release
Submodule .release updated 1 files
+1 −2 finish.sh
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

### [0.8.5] - 2026-03-15

- zone.GET_req: add search params
- zone_rec.owner: disable domain/hostname validation
- zone_rec: add algorithm
- zone_rec: change gateway type to a number
- zone_rec: add timestamp

### [0.8.4] - 2026-03-14

- disable domain validation, until joi.string.domain supports /
Expand Down Expand Up @@ -95,11 +103,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
[0.6.3]: https://github.com/NicTool/validate/releases/tag/v0.6.3
[0.7.0]: https://github.com/NicTool/validate/releases/tag/0.7.0
[0.7.1]: https://github.com/NicTool/validate/releases/tag/v0.7.1
[0.7.2]: https://github.com/NicTool/validate/releases/tag/0.7.2
[0.7.2]: https://github.com/NicTool/validate/releases/tag/v0.7.2
[0.7.3]: https://github.com/NicTool/validate/releases/tag/0.7.3
[0.7.4]: https://github.com/NicTool/validate/releases/tag/v0.7.4
[0.8.0]: https://github.com/NicTool/validate/releases/tag/v0.8.0
[0.8.1]: https://github.com/NicTool/validate/releases/tag/v0.8.1
[0.8.2]: https://github.com/NicTool/validate/releases/tag/v0.8.2
[0.8.3]: https://github.com/NicTool/validate/releases/tag/v0.8.3
[0.8.4]: https://github.com/NicTool/validate/releases/tag/v0.8.4
[0.8.5]: https://github.com/NicTool/validate/releases/tag/v0.8.5
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This handcrafted artisanal software is brought to you by:

| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/NicTool/validate/commits?author=msimerson">23</a>) |
| <img height="80" src="https://avatars.githubusercontent.com/u/261635?v=4"><br><a href="https://github.com/msimerson">msimerson</a> (<a href="https://github.com/NicTool/validate/commits?author=msimerson">24</a>) |
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |

<sub>this file is generated by [.release](https://github.com/msimerson/.release).
Expand Down
7 changes: 7 additions & 0 deletions lib/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ exports.v3 = Joi.object({
exports.GET_req = Joi.object({
id: exports.id,
zone: exports.zone,
search: Joi.string().max(255).allow(''),
zone_like: Joi.string().max(255).allow(''),
description_like: Joi.string().max(255).allow(''),
limit: shared.uint32,
offset: shared.uint32,
sort_by: Joi.string().valid('id', 'zone', 'description', 'last_modified'),
sort_dir: Joi.string().lowercase().valid('asc', 'desc'),
deleted: Joi.boolean(),
})

Expand Down
13 changes: 11 additions & 2 deletions lib/zone_record.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ exports.id = shared.uint32.min(1).required()
exports.owner = Joi.string()
.min(1)
.max(255)
.domain({ minDomainSegments: 1, allowFullyQualified: false, tlds: false })
// .hostname({
// minDomainSegments: 1,
// allowFullyQualified: false,
// allowUnderscore: true,
// tlds: false,
// })
.required()

exports.v3 = Joi.object({
Expand Down Expand Up @@ -61,6 +66,8 @@ exports.v3 = Joi.object({

address: Joi.string().min(2).max(39),

algorithm: Joi.number().integer().min(0).max(255),

cname: Joi.string(),

data: Joi.string(),
Expand All @@ -77,7 +84,7 @@ exports.v3 = Joi.object({

gateway: Joi.string().empty(''),

'gateway type': Joi.string().empty(''),
'gateway type': Joi.number().empty(''),

location: Joi.string().empty(''),

Expand Down Expand Up @@ -105,6 +112,8 @@ exports.v3 = Joi.object({

target: Joi.string(),

timestamp: Joi.date(),

weight: shared.uint16,

value: Joi.string(),
Expand Down
10 changes: 9 additions & 1 deletion lib/zone_record.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@ describe('zone_record', function () {
assert.strictEqual(error.message, '"owner" is not allowed to be empty')
})

it('accepts underscores in labels', () => {
const testCase = JSON.parse(JSON.stringify(testZR))
testCase.owner = '_acme-challenge.example'
const { error, value } = schema.validate(testCase)
assert.ifError(error)
assert.deepEqual(value, testCase)
})

for (const owner of ['a.m.', 'something.test.']) {
it(`rejects invalid: ${owner}`, () => {
it.skip(`rejects invalid: ${owner}`, () => {
const testCase = JSON.parse(JSON.stringify(testZR))
testCase.owner = owner
const { error } = schema.validate(testCase)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nictool/validate",
"version": "0.8.4",
"version": "0.8.5",
"description": "NicTool Object Validation",
"files": [
"lib",
Expand Down
Loading