Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: remove refs property from schemas #196

Merged
merged 1 commit into from
Jul 23, 2024
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
11 changes: 3 additions & 8 deletions proto/observation/v1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ message Observation_1 {
optional double lat = 5;
optional double lon = 6;

message Ref {
bytes id = 1;
}
repeated Ref refs = 7;

// ATTACHMENT
enum AttachmentType {
photo = 0;
Expand All @@ -34,10 +29,10 @@ message Observation_1 {
AttachmentType type = 3;
bytes hash = 4;
}
repeated Attachment attachments = 8;
repeated Attachment attachments = 7;

// TAGS
map<string, TagValue_1> tags = 9;
map<string, TagValue_1> tags = 8;

// METADATA
message Metadata {
Expand Down Expand Up @@ -69,5 +64,5 @@ message Observation_1 {
optional Position lastSavedPosition = 4;
optional PositionProvider positionProvider = 5;
}
optional Metadata metadata = 10;
optional Metadata metadata = 9;
}
16 changes: 1 addition & 15 deletions schema/observation/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@
"minimum": -180,
"maximum": 180
},
"refs": {
"type": "array",
"description": "References to any nodes or ways that this observation is related to.",
"items": {
"type": "object",
"properties": {
"id": {
"description": "hex-encoded id of the element that this observation references",
"type": "string"
}
},
"required": ["id"]
}
},
"attachments": {
"type": "array",
"description": "media or other data that are attached to this observation",
Expand Down Expand Up @@ -190,6 +176,6 @@
"additionalProperties": false
}
},
"required": ["schemaName", "tags", "refs", "attachments", "metadata"],
"required": ["schemaName", "tags", "attachments", "metadata"],
"additionalProperties": false
}
1 change: 0 additions & 1 deletion src/lib/decode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const convertObservation: ConvertFunction<'observation'> = (
const obs: Observation = {
...jsonSchemaCommon,
...rest,
refs: message.refs?.map(({ id }) => ({ id: id.toString('hex') })),
attachments: message.attachments.map(convertAttachment),
tags: convertTags(message.tags),
metadata: message.metadata || {},
Expand Down
4 changes: 0 additions & 4 deletions src/lib/encode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ export const convertPreset: ConvertFunction<'preset'> = (mapeoDoc) => {
export const convertObservation: ConvertFunction<'observation'> = (
mapeoDoc
) => {
const refs = mapeoDoc.refs.map((ref) => {
return { id: Buffer.from(ref.id, 'hex') }
})
const attachments = mapeoDoc.attachments.map(convertAttachment)
const metadata: Observation_1_Metadata = mapeoDoc.metadata && {
...Observation_1_Metadata.fromPartial(mapeoDoc.metadata),
Expand All @@ -100,7 +97,6 @@ export const convertObservation: ConvertFunction<'observation'> = (
return {
common: convertCommon(mapeoDoc),
...mapeoDoc,
refs,
attachments,
tags: convertTags(mapeoDoc.tags),
metadata,
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/bad-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const badDocs = [
updatedAt: cachedValues.updatedAt,
createdBy: cachedValues.createdBy,
links: [],
refs: [],
attachments: [],
tags: {},
metadata: {},
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/good-docs-completed.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const goodDocsCompleted = [
links: [],
lat: 24.0424,
lon: 21.0214,
refs: [],
attachments: [
{
name: 'myFile',
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/good-docs-minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const goodDocsMinimal = [
updatedAt: cachedValues.updatedAt,
createdBy: cachedValues.createdBy,
links: [],
refs: [],
attachments: [],
tags: {},
metadata: {},
Expand Down
Loading